Skip to content

Official python 3.7 support #698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Oct 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
515d97d
Create interop37.cs
den-run-ai Jul 5, 2018
37f6c8f
Update interop37.cs
den-run-ai Jul 5, 2018
77e4d2d
try faking minimal crypt.h
den-run-ai Jul 5, 2018
482d3fe
Merge branch 'master' into py37
filmor Jul 23, 2018
e8895bc
Update appveyor.yml
den-run-ai Aug 3, 2018
8b0145c
Update test_exceptions.py
den-run-ai Aug 6, 2018
049c7da
Update test_exceptions.py
den-run-ai Aug 6, 2018
279c91d
official python 3.7 on travis CI, but xenial with sudo
den-run-ai Aug 7, 2018
86579be
xenial support for mono and .netcore
den-run-ai Aug 7, 2018
e60d93e
Update .travis.yml
den-run-ai Aug 14, 2018
5ef579a
passing pthread support to clang
den-run-ai Aug 15, 2018
97c8245
force through posix threading support
den-run-ai Aug 15, 2018
ed14f3b
Update geninterop.py
den-run-ai Aug 15, 2018
5d39b50
temporary diagnostic build to check for nuget/msbuild errors in mono
den-run-ai Aug 15, 2018
98f4f84
trying out "detailed" verbosity to find out the issues with mono/msbu…
den-run-ai Aug 22, 2018
b3168cf
try one more verbosity level - "normal"
den-run-ai Aug 22, 2018
80c6419
Merge branch 'master' into py37
filmor Aug 30, 2018
49467dd
Update setup.py
den-run-ai Sep 11, 2018
89dff06
Merge branch 'master' into py37
den-run-ai Oct 12, 2018
5db2f27
Merge branch 'master' into py37
filmor Oct 18, 2018
c1a47a5
revert back nuget update
den-run-ai Oct 18, 2018
cea848e
Update setup.py
den-run-ai Oct 18, 2018
badb6ea
Update Python.Runtime.15.csproj
den-run-ai Oct 18, 2018
64c39f0
Update Python.Runtime.csproj
den-run-ai Oct 18, 2018
222874c
Update CHANGELOG.md
den-run-ai Oct 18, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ matrix:
- dotnet-hostfxr-2.0.0
- dotnet-runtime-2.0.0
- dotnet-sdk-2.0.0

- python: 3.4
env: *xplat-env
addons: *xplat-addons
Expand All @@ -33,9 +34,24 @@ matrix:
- python: 3.6
env: *xplat-env
addons: *xplat-addons
- python: "3.7-dev"

- python: 3.7
env: *xplat-env
addons: *xplat-addons
dist: xenial
sudo: true
addons: &xplat-addons-xenial
apt:
sources:
- sourceline: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main
key_url: https://packages.microsoft.com/keys/microsoft.asc
- sourceline: deb https://download.mono-project.com/repo/ubuntu stable-xenial main
key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF
packages:
- mono-devel
- ca-certificates-mono
- dotnet-hostfxr-2.0.0
- dotnet-runtime-2.0.0
- dotnet-sdk-2.0.0

# --------------------- Classic builds ------------------------
- python: 2.7
Expand All @@ -52,15 +68,18 @@ matrix:
- python: 3.6
env: *classic-env

- python: "3.7-dev"
env: *classic-env

allow_failures:
- python: "3.7-dev"
env: *xplat-env

- python: "3.7-dev"
- python: 3.7
env: *classic-env
dist: xenial
sudo: true
addons:
apt:
sources:
- sourceline: deb http://download.mono-project.com/repo/ubuntu xenial main
key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF
packages:
- mono-devel
- ca-certificates-mono

env:
global:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
- Implemented GetDynamicMemberNames() for PyObject to allow dynamic object members to be visible in the debugger ([#443][i443])([#690][p690])
- Incorporated reference-style links to issues and pull requests in the CHANGELOG ([#608][i608])
- Added detailed comments about aproaches and dangers to handle multi-app-domains ([#625][p625])
- Python 3.7 support, builds and testing added. Defaults changed from Python 3.6 to 3.7 ([#698][p698])

### Changed

Expand Down
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ environment:
BUILD_OPTS: --xplat
- PYTHON_VERSION: 3.6
BUILD_OPTS: --xplat
- PYTHON_VERSION: 3.7
BUILD_OPTS: --xplat
- PYTHON_VERSION: 2.7
- PYTHON_VERSION: 3.4
- PYTHON_VERSION: 3.5
- PYTHON_VERSION: 3.6
- PYTHON_VERSION: 3.7

matrix:
allow_failures:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Allow config/verbosity to be set from cli
# http://stackoverflow.com/a/4792601/5208670
CONFIG = "Release" # Release or Debug
VERBOSITY = "minimal" # quiet, minimal, normal, detailed, diagnostic
VERBOSITY = "normal" # quiet, minimal, normal, detailed, diagnostic

is_64bits = sys.maxsize > 2**32
DEVTOOLS = "MsDev" if sys.platform == "win32" else "Mono"
Expand Down Expand Up @@ -516,10 +516,10 @@ def run(self):
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS :: MacOS X',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/Python.Runtime.15.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<Python2Version>$(PYTHONNET_PY2_VERSION)</Python2Version>
<Python2Version Condition="'$(Python2Version)'==''">PYTHON27</Python2Version>
<Python3Version>$(PYTHONNET_PY3_VERSION)</Python3Version>
<Python3Version Condition="'$(Python3Version)'==''">PYTHON36</Python3Version>
<Python3Version Condition="'$(Python3Version)'==''">PYTHON37</Python3Version>
<PythonWinDefineConstants>$(PYTHONNET_WIN_DEFINE_CONSTANTS)</PythonWinDefineConstants>
<PythonWinDefineConstants Condition="'$(PythonWinDefineConstants)'==''">UCS2</PythonWinDefineConstants>
<PythonMonoDefineConstants>$(PYTHONNET_MONO_DEFINE_CONSTANTS)</PythonMonoDefineConstants>
Expand Down
10 changes: 5 additions & 5 deletions src/runtime/Python.Runtime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'ReleaseMonoPY3'">
<DefineConstants Condition="'$(DefineConstants)' == ''">PYTHON3;PYTHON36;UCS4</DefineConstants>
<DefineConstants Condition="'$(DefineConstants)' == ''">PYTHON3;PYTHON37;UCS4</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
</PropertyGroup>
Expand All @@ -46,7 +46,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'DebugMonoPY3'">
<DebugSymbols>true</DebugSymbols>
<DefineConstants Condition="'$(DefineConstants)' == ''">PYTHON3;PYTHON36;UCS4;TRACE;DEBUG</DefineConstants>
<DefineConstants Condition="'$(DefineConstants)' == ''">PYTHON3;PYTHON37;UCS4;TRACE;DEBUG</DefineConstants>
<Optimize>false</Optimize>
<DebugType>full</DebugType>
</PropertyGroup>
Expand All @@ -56,7 +56,7 @@
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'ReleaseWinPY3'">
<DefineConstants Condition="'$(DefineConstants)' == ''">PYTHON3;PYTHON36;UCS2</DefineConstants>
<DefineConstants Condition="'$(DefineConstants)' == ''">PYTHON3;PYTHON37;UCS2</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
</PropertyGroup>
Expand All @@ -68,7 +68,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'DebugWinPY3'">
<DebugSymbols>true</DebugSymbols>
<DefineConstants Condition="'$(DefineConstants)' == ''">PYTHON3;PYTHON36;UCS2;TRACE;DEBUG</DefineConstants>
<DefineConstants Condition="'$(DefineConstants)' == ''">PYTHON3;PYTHON37;UCS2;TRACE;DEBUG</DefineConstants>
<Optimize>false</Optimize>
<DebugType>full</DebugType>
</PropertyGroup>
Expand Down Expand Up @@ -166,4 +166,4 @@
<Copy SourceFiles="$(TargetAssembly)" DestinationFolder="$(PythonBuildDir)" />
<!--Copy SourceFiles="$(TargetAssemblyPdb)" Condition="Exists('$(TargetAssemblyPdb)')" DestinationFolder="$(PythonBuildDir)" /-->
</Target>
</Project>
</Project>
149 changes: 149 additions & 0 deletions src/runtime/interop37.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
// Auto-generated by geninterop.py.
// DO NOT MODIFIY BY HAND.


#if PYTHON37
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Text;

namespace Python.Runtime
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
internal class TypeOffset
{
static TypeOffset()
{
Type type = typeof(TypeOffset);
FieldInfo[] fi = type.GetFields();
int size = IntPtr.Size;
for (int i = 0; i < fi.Length; i++)
{
fi[i].SetValue(null, i * size);
}
}

public static int magic()
{
return ob_size;
}

// Auto-generated from PyHeapTypeObject in Python.h
public static int ob_refcnt = 0;
public static int ob_type = 0;
public static int ob_size = 0;
public static int tp_name = 0;
public static int tp_basicsize = 0;
public static int tp_itemsize = 0;
public static int tp_dealloc = 0;
public static int tp_print = 0;
public static int tp_getattr = 0;
public static int tp_setattr = 0;
public static int tp_as_async = 0;
public static int tp_repr = 0;
public static int tp_as_number = 0;
public static int tp_as_sequence = 0;
public static int tp_as_mapping = 0;
public static int tp_hash = 0;
public static int tp_call = 0;
public static int tp_str = 0;
public static int tp_getattro = 0;
public static int tp_setattro = 0;
public static int tp_as_buffer = 0;
public static int tp_flags = 0;
public static int tp_doc = 0;
public static int tp_traverse = 0;
public static int tp_clear = 0;
public static int tp_richcompare = 0;
public static int tp_weaklistoffset = 0;
public static int tp_iter = 0;
public static int tp_iternext = 0;
public static int tp_methods = 0;
public static int tp_members = 0;
public static int tp_getset = 0;
public static int tp_base = 0;
public static int tp_dict = 0;
public static int tp_descr_get = 0;
public static int tp_descr_set = 0;
public static int tp_dictoffset = 0;
public static int tp_init = 0;
public static int tp_alloc = 0;
public static int tp_new = 0;
public static int tp_free = 0;
public static int tp_is_gc = 0;
public static int tp_bases = 0;
public static int tp_mro = 0;
public static int tp_cache = 0;
public static int tp_subclasses = 0;
public static int tp_weaklist = 0;
public static int tp_del = 0;
public static int tp_version_tag = 0;
public static int tp_finalize = 0;
public static int am_await = 0;
public static int am_aiter = 0;
public static int am_anext = 0;
public static int nb_add = 0;
public static int nb_subtract = 0;
public static int nb_multiply = 0;
public static int nb_remainder = 0;
public static int nb_divmod = 0;
public static int nb_power = 0;
public static int nb_negative = 0;
public static int nb_positive = 0;
public static int nb_absolute = 0;
public static int nb_bool = 0;
public static int nb_invert = 0;
public static int nb_lshift = 0;
public static int nb_rshift = 0;
public static int nb_and = 0;
public static int nb_xor = 0;
public static int nb_or = 0;
public static int nb_int = 0;
public static int nb_reserved = 0;
public static int nb_float = 0;
public static int nb_inplace_add = 0;
public static int nb_inplace_subtract = 0;
public static int nb_inplace_multiply = 0;
public static int nb_inplace_remainder = 0;
public static int nb_inplace_power = 0;
public static int nb_inplace_lshift = 0;
public static int nb_inplace_rshift = 0;
public static int nb_inplace_and = 0;
public static int nb_inplace_xor = 0;
public static int nb_inplace_or = 0;
public static int nb_floor_divide = 0;
public static int nb_true_divide = 0;
public static int nb_inplace_floor_divide = 0;
public static int nb_inplace_true_divide = 0;
public static int nb_index = 0;
public static int nb_matrix_multiply = 0;
public static int nb_inplace_matrix_multiply = 0;
public static int mp_length = 0;
public static int mp_subscript = 0;
public static int mp_ass_subscript = 0;
public static int sq_length = 0;
public static int sq_concat = 0;
public static int sq_repeat = 0;
public static int sq_item = 0;
public static int was_sq_slice = 0;
public static int sq_ass_item = 0;
public static int was_sq_ass_slice = 0;
public static int sq_contains = 0;
public static int sq_inplace_concat = 0;
public static int sq_inplace_repeat = 0;
public static int bf_getbuffer = 0;
public static int bf_releasebuffer = 0;
public static int name = 0;
public static int ht_slots = 0;
public static int qualname = 0;
public static int ht_cached_keys = 0;

/* here are optional user slots, followed by the members. */
public static int members = 0;
}
}

#endif
3 changes: 2 additions & 1 deletion src/tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ def test_python_compat_of_managed_exceptions():
assert e.args == (msg,)
assert isinstance(e.args, tuple)
if PY3:
assert repr(e) == "OverflowException('Simple message',)"
strexp = "OverflowException('Simple message"
assert repr(e)[:len(strexp)] == strexp
elif PY2:
assert repr(e) == "OverflowException(u'Simple message',)"

Expand Down
1 change: 1 addition & 0 deletions tools/geninterop/fake_libc_include/crypt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "features.h"
5 changes: 3 additions & 2 deletions tools/geninterop/geninterop.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ def preprocess_python_headers():
"-D", "__attribute__(x)=",
"-D", "__inline__=inline",
"-D", "__asm__=;#pragma asm",
"-D", "__int64=long long"
"-D", "__int64=long long",
"-D", "_POSIX_THREADS"
]

if hasattr(sys, "abiflags"):
Expand All @@ -185,7 +186,7 @@ def preprocess_python_headers():
defines.extend(("-D", "PYTHON_WITH_WIDE_UNICODE"))

python_h = os.path.join(include_py, "Python.h")
cmd = ["clang", "-I"] + include_dirs + defines + ["-E", python_h]
cmd = ["clang", "-pthread", "-I"] + include_dirs + defines + ["-E", python_h]

# normalize as the parser doesn't like windows line endings.
lines = []
Expand Down