diff --git a/.travis.yml b/.travis.yml index 357fc758f..190a89447 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ python: - 3.2 - 3.4 - 3.5 + - 3.6 before_install: - sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ trusty main universe" - sudo apt-get install software-properties-common diff --git a/appveyor.yml b/appveyor.yml index 3e6f3e8c2..6ed23a32e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -57,6 +57,16 @@ environment: CONDA_BLD: "C:\\miniconda-64" CONDA_BLD_ARCH: "64" + - PYTHON: "C:\\Python36" + CONDA_PY: "36" + CONDA_BLD: "C:\\miniconda-32" + CONDA_BLD_ARCH: "32" + + - PYTHON: "C:\\Python36-x64" + CONDA_PY: "36" + CONDA_BLD: "C:\\miniconda-64" + CONDA_BLD_ARCH: "64" + install: # install conda and deps - powershell .\ci\install.ps1 diff --git a/setup.py b/setup.py index 05ae35906..c5b00049d 100644 --- a/setup.py +++ b/setup.py @@ -343,6 +343,7 @@ def _get_interop_filename(): 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Programming Language :: C#', 'License :: OSI Approved :: Zope Public License', 'Development Status :: 5 - Production/Stable', diff --git a/src/clrmodule/ClrModule.cs b/src/clrmodule/ClrModule.cs index 62fdf497f..b90df485d 100644 --- a/src/clrmodule/ClrModule.cs +++ b/src/clrmodule/ClrModule.cs @@ -26,7 +26,7 @@ public class clrModule { -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [RGiesecke.DllExport.DllExport("PyInit_clr", System.Runtime.InteropServices.CallingConvention.StdCall)] public static IntPtr PyInit_clr() #else @@ -94,7 +94,7 @@ public static void initclr() #if DEBUG_PRINT System.Console.WriteLine("Could not load Python.Runtime, so sad."); #endif -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) return IntPtr.Zero; #else return; @@ -106,7 +106,7 @@ public static void initclr() // So now we get the PythonEngine and execute the InitExt method on it. var pythonEngineType = pythonRuntime.GetType("Python.Runtime.PythonEngine"); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) return (IntPtr)pythonEngineType.InvokeMember("InitExt", System.Reflection.BindingFlags.InvokeMethod, null, null, null); #else pythonEngineType.InvokeMember("InitExt", System.Reflection.BindingFlags.InvokeMethod, null, null, null); diff --git a/src/runtime/converter.cs b/src/runtime/converter.cs index 1170efe7a..de0003c51 100644 --- a/src/runtime/converter.cs +++ b/src/runtime/converter.cs @@ -84,7 +84,7 @@ internal static IntPtr GetPythonTypeByAlias(Type op) { return Runtime.PyUnicodeType; } -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) else if ((op == int16Type) || (op == int32Type) || (op == int64Type)) { @@ -450,7 +450,7 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result, return true; case TypeCode.Int32: -#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) // Trickery to support 64-bit platforms. if (IntPtr.Size == 4) { @@ -511,7 +511,7 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result, return true; case TypeCode.Byte: -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) if (Runtime.PyObject_TypeCheck(value, Runtime.PyBytesType)) { if (Runtime.PyBytes_Size(value) == 1) @@ -556,7 +556,7 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result, return true; case TypeCode.SByte: -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) if (Runtime.PyObject_TypeCheck(value, Runtime.PyBytesType)) { if (Runtime.PyBytes_Size(value) == 1) { op = Runtime.PyBytes_AS_STRING(value); @@ -599,7 +599,7 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result, return true; case TypeCode.Char: -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) if (Runtime.PyObject_TypeCheck(value, Runtime.PyBytesType)) { if (Runtime.PyBytes_Size(value) == 1) { op = Runtime.PyBytes_AS_STRING(value); diff --git a/src/runtime/delegateobject.cs b/src/runtime/delegateobject.cs index 54c41780e..19bbbe0e8 100644 --- a/src/runtime/delegateobject.cs +++ b/src/runtime/delegateobject.cs @@ -102,7 +102,7 @@ public static IntPtr tp_call(IntPtr ob, IntPtr args, IntPtr kw) //==================================================================== // Implements __cmp__ for reflected delegate types. //==================================================================== -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) public static new IntPtr tp_richcompare(IntPtr ob, IntPtr other, int op) { if (op != Runtime.Py_EQ && op != Runtime.Py_NE) { diff --git a/src/runtime/exceptions.cs b/src/runtime/exceptions.cs index 48f40958d..30c8c7e27 100644 --- a/src/runtime/exceptions.cs +++ b/src/runtime/exceptions.cs @@ -84,7 +84,7 @@ private Exceptions() internal static void Initialize() { -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) exceptions_module = Runtime.PyImport_ImportModule("builtins"); #else exceptions_module = Runtime.PyImport_ImportModule("exceptions"); @@ -371,15 +371,15 @@ internal static IntPtr RaiseTypeError(string message) puplic static variables on the Exceptions class filled in from the python class using reflection in Initialize() looked up by name, not posistion. */ -#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) public static IntPtr BaseException; #endif public static IntPtr Exception; public static IntPtr StopIteration; -#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) public static IntPtr GeneratorExit; #endif -#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) public static IntPtr StandardError; #endif public static IntPtr ArithmeticError; @@ -436,7 +436,7 @@ puplic static variables on the Exceptions class filled in from public static IntPtr SyntaxWarning; public static IntPtr RuntimeWarning; public static IntPtr FutureWarning; -#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) public static IntPtr ImportWarning; public static IntPtr UnicodeWarning; //PyAPI_DATA(PyObject *) PyExc_BytesWarning; diff --git a/src/runtime/importhook.cs b/src/runtime/importhook.cs index 8f8f032db..7ebb13be0 100644 --- a/src/runtime/importhook.cs +++ b/src/runtime/importhook.cs @@ -14,7 +14,7 @@ internal class ImportHook static CLRModule root; static MethodWrapper hook; -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) static IntPtr py_clr_module; static IntPtr module_def; #endif @@ -30,7 +30,7 @@ internal static void Initialize() // but it provides the most "Pythonic" way of dealing with CLR // modules (Python doesn't provide a way to emulate packages). IntPtr dict = Runtime.PyImport_GetModuleDict(); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) IntPtr mod = Runtime.PyImport_ImportModule("builtins"); py_import = Runtime.PyObject_GetAttrString(mod, "__import__"); #else @@ -43,7 +43,7 @@ internal static void Initialize() root = new CLRModule(); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) // create a python module with the same methods as the clr module-like object module_def = ModuleDefOffset.AllocModuleDef("clr"); py_clr_module = Runtime.PyModule_Create2(module_def, 3); @@ -70,7 +70,7 @@ internal static void Initialize() internal static void Shutdown() { -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) if (0 != Runtime.Py_IsInitialized()) { Runtime.XDecref(py_clr_module); Runtime.XDecref(root.pyHandle); @@ -95,7 +95,7 @@ internal static void Shutdown() public static IntPtr GetCLRModule(IntPtr? fromList = null) { root.InitializePreload(); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) // update the module dictionary with the contents of the root dictionary root.LoadNames(); IntPtr py_mod_dict = Runtime.PyModule_GetDict(py_clr_module); diff --git a/src/runtime/interop.cs b/src/runtime/interop.cs index 7288ff58c..fa5c258f9 100644 --- a/src/runtime/interop.cs +++ b/src/runtime/interop.cs @@ -156,7 +156,7 @@ public static int Size() public static int args = 0; #if (PYTHON25 || PYTHON26 || PYTHON27) public static int message = 0; -#elif (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#elif (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) public static int traceback = 0; public static int context = 0; public static int cause = 0; @@ -171,7 +171,7 @@ public static int Size() } -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] internal class BytesOffset { @@ -292,10 +292,10 @@ internal class TypeFlags /* XXX Reusing reserved constants */ public static int Managed = (1 << 15); // PythonNet specific public static int Subclass = (1 << 16); // PythonNet specific -#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) public static int HaveIndex = (1 << 17); #endif -#if (PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) /* Objects support nb_index in PyNumberMethods */ public static int HaveVersionTag = (1 << 18); public static int ValidVersionTag = (1 << 19); @@ -331,7 +331,7 @@ internal class TypeFlags #endif // Default flags for Python 3 -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) public static int Default = ( HaveStacklessExtension | HaveVersionTag); @@ -394,7 +394,7 @@ static Interop() pmap["nb_add"] = p["BinaryFunc"]; pmap["nb_subtract"] = p["BinaryFunc"]; pmap["nb_multiply"] = p["BinaryFunc"]; -#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) pmap["nb_divide"] = p["BinaryFunc"]; #endif pmap["nb_remainder"] = p["BinaryFunc"]; @@ -419,7 +419,7 @@ static Interop() pmap["nb_inplace_add"] = p["BinaryFunc"]; pmap["nb_inplace_subtract"] = p["BinaryFunc"]; pmap["nb_inplace_multiply"] = p["BinaryFunc"]; -#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) pmap["nb_inplace_divide"] = p["BinaryFunc"]; #endif pmap["nb_inplace_remainder"] = p["BinaryFunc"]; @@ -433,7 +433,7 @@ static Interop() pmap["nb_true_divide"] = p["BinaryFunc"]; pmap["nb_inplace_floor_divide"] = p["BinaryFunc"]; pmap["nb_inplace_true_divide"] = p["BinaryFunc"]; -#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) pmap["nb_index"] = p["UnaryFunc"]; #endif diff --git a/src/runtime/interop35.cs b/src/runtime/interop35.cs index a0f0f3153..99fde4c32 100644 --- a/src/runtime/interop35.cs +++ b/src/runtime/interop35.cs @@ -143,4 +143,4 @@ public static int magic() { public static int members = 0; } } -#endif \ No newline at end of file +#endif diff --git a/src/runtime/interop36.cs b/src/runtime/interop36.cs new file mode 100644 index 000000000..4afa66964 --- /dev/null +++ b/src/runtime/interop36.cs @@ -0,0 +1,144 @@ + +// Auto-generated by geninterop.py. +// DO NOT MODIFIY BY HAND. +#if (PYTHON36) +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 diff --git a/src/runtime/pythonengine.cs b/src/runtime/pythonengine.cs index 70a1c557b..f00e4f71b 100644 --- a/src/runtime/pythonengine.cs +++ b/src/runtime/pythonengine.cs @@ -186,7 +186,7 @@ public static void Initialize() // CPython interpreter process - this bootstraps the managed runtime // when it is imported by the CLR extension module. //==================================================================== -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) public static IntPtr InitExt() { #else public static void InitExt() @@ -234,12 +234,12 @@ public static void InitExt() catch (PythonException e) { e.Restore(); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) return IntPtr.Zero; #endif } -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) return Python.Runtime.ImportHook.GetCLRModule(); #endif } diff --git a/src/runtime/runtime.cs b/src/runtime/runtime.cs index 7f5123012..d88c30f0f 100644 --- a/src/runtime/runtime.cs +++ b/src/runtime/runtime.cs @@ -7,7 +7,7 @@ #endif -#if (UCS2 && (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)) +#if (UCS2 && (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36)) using System.Text; #endif @@ -139,8 +139,12 @@ public class Runtime public const string pyversion = "3.5"; public const int pyversionnumber = 35; #endif -#if ! (PYTHON23 || PYTHON24 || PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) -#error You must define one of PYTHON23 to PYTHON35 +#if (PYTHON36) + public const string pyversion = "3.6"; + public const int pyversionnumber = 36; +#endif +#if ! (PYTHON23 || PYTHON24 || PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) +#error You must define one of PYTHON23 to PYTHON36 #endif #if (PYTHON23) @@ -171,6 +175,9 @@ public class Runtime #if (PYTHON35) internal const string dllBase = "python3.5"; #endif +#if (PYTHON36) + internal const string dllBase = "python3.6"; +#endif #else #if (PYTHON32) internal const string dllBase = "python32"; @@ -184,6 +191,9 @@ public class Runtime #if (PYTHON35) internal const string dllBase = "python35"; #endif +#if (PYTHON36) + internal const string dllBase = "python36"; +#endif #endif #if (PYTHON_WITH_PYDEBUG) @@ -231,7 +241,7 @@ internal static void Initialize() Runtime.PyEval_InitThreads(); } -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) IntPtr op = Runtime.PyImport_ImportModule("builtins"); IntPtr dict = Runtime.PyObject_GetAttrString(op, "__dict__"); #else @@ -262,7 +272,7 @@ internal static void Initialize() PyWrapperDescriptorType = Runtime.PyObject_Type(op); Runtime.XDecref(op); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) Runtime.XDecref(dict); #endif @@ -274,7 +284,7 @@ internal static void Initialize() PyUnicodeType = Runtime.PyObject_Type(op); Runtime.XDecref(op); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) op = Runtime.PyBytes_FromString("bytes"); PyBytesType = Runtime.PyObject_Type(op); Runtime.XDecref(op); @@ -304,7 +314,7 @@ internal static void Initialize() PyFloatType = Runtime.PyObject_Type(op); Runtime.XDecref(op); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) PyClassType = IntPtr.Zero; PyInstanceType = IntPtr.Zero; #else @@ -325,7 +335,7 @@ internal static void Initialize() Error = new IntPtr(-1); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) IntPtr dll = IntPtr.Zero; if ("__Internal" != Runtime.dll) { NativeMethods.LoadLibrary(Runtime.dll); @@ -396,7 +406,7 @@ internal static int AtExit() internal static IntPtr PyNoneType; internal static IntPtr PyTypeType; -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) internal static IntPtr PyBytesType; internal static IntPtr _PyObject_NextNotImplemented; #endif @@ -697,7 +707,7 @@ internal unsafe static extern void internal unsafe static extern IntPtr PyGILState_GetThisThreadState(); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl, ExactSpelling=true, CharSet=CharSet.Ansi)] public unsafe static extern int @@ -765,7 +775,7 @@ internal unsafe static extern IntPtr PyEval_GetLocals(); -#if PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 +#if PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36 [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl, ExactSpelling=true, CharSet=CharSet.Ansi)] [return: MarshalAs(UnmanagedType.LPWStr)] @@ -1016,7 +1026,7 @@ internal unsafe static extern IntPtr internal unsafe static extern IntPtr PyObject_CallObject(IntPtr pointer, IntPtr args); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl, ExactSpelling=true, CharSet=CharSet.Ansi)] internal unsafe static extern int @@ -1098,7 +1108,7 @@ internal unsafe static extern IntPtr internal unsafe static extern IntPtr PyObject_Str(IntPtr pointer); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, EntryPoint="PyObject_Str", ExactSpelling = true, CharSet = CharSet.Ansi)] @@ -1121,7 +1131,7 @@ internal unsafe static extern IntPtr // Python number API //==================================================================== -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl, EntryPoint = "PyNumber_Long", ExactSpelling=true, CharSet=CharSet.Ansi)] @@ -1174,7 +1184,7 @@ internal static IntPtr PyInt_FromInt64(long value) return PyInt_FromLong(v); } -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "PyLong_FromLong", ExactSpelling = true, CharSet = CharSet.Ansi)] @@ -1522,7 +1532,7 @@ internal static IntPtr PyString_FromString(string value) return PyString_FromStringAndSize(value, value.Length); } -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl, ExactSpelling=true, CharSet=CharSet.Ansi)] internal unsafe static extern IntPtr @@ -1553,7 +1563,7 @@ internal static IntPtr PyString_FromStringAndSize(string value, int length) } } -#if (PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Unicode)] internal unsafe static extern IntPtr @@ -1597,7 +1607,7 @@ internal static bool PyUnicode_Check(IntPtr ob) } #if (UCS2) -#if (PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl, ExactSpelling=true, CharSet=CharSet.Unicode)] internal unsafe static extern IntPtr @@ -1694,7 +1704,7 @@ internal unsafe static string GetManagedString(IntPtr op) IntPtr type = PyObject_TYPE(op); // Python 3 strings are all unicode -#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) if (type == Runtime.PyStringType) { return Marshal.PtrToStringAnsi( @@ -1716,7 +1726,7 @@ internal unsafe static string GetManagedString(IntPtr op) #endif #if (UCS4) -#if (PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, ExactSpelling=true, CharSet=CharSet.Unicode)] internal unsafe static extern IntPtr @@ -1818,7 +1828,7 @@ internal unsafe static string GetManagedString(IntPtr op) IntPtr type = PyObject_TYPE(op); // Python 3 strings are all unicode -#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) if (type == Runtime.PyStringType) { return Marshal.PtrToStringAnsi( @@ -2036,7 +2046,7 @@ internal unsafe static extern int // Python iterator API //==================================================================== -#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if !(PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] internal unsafe static extern bool @@ -2080,7 +2090,7 @@ internal unsafe static extern IntPtr internal unsafe static extern string PyModule_GetFilename(IntPtr module); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl, ExactSpelling=true, CharSet=CharSet.Ansi)] internal unsafe static extern IntPtr diff --git a/src/runtime/typemanager.cs b/src/runtime/typemanager.cs index ecac9203c..6f1eb604f 100644 --- a/src/runtime/typemanager.cs +++ b/src/runtime/typemanager.cs @@ -407,7 +407,7 @@ internal static IntPtr AllocateTypeObject(string name) // Cheat a little: we'll set tp_name to the internal char * of // the Python version of the type name - otherwise we'd have to // allocate the tp_name and would have no way to free it. -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) // For python3 we leak two objects. One for the ascii representation // required for tp_name, and another for the unicode representation // for ht_name. @@ -421,7 +421,7 @@ internal static IntPtr AllocateTypeObject(string name) Marshal.WriteIntPtr(type, TypeOffset.tp_name, raw); Marshal.WriteIntPtr(type, TypeOffset.name, temp); -#if (PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) Marshal.WriteIntPtr(type, TypeOffset.qualname, temp); #endif @@ -436,7 +436,7 @@ internal static IntPtr AllocateTypeObject(string name) temp = new IntPtr(ptr + TypeOffset.mp_length); Marshal.WriteIntPtr(type, TypeOffset.tp_as_mapping, temp); -#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35) +#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36) temp = new IntPtr(ptr + TypeOffset.bf_getbuffer); Marshal.WriteIntPtr(type, TypeOffset.tp_as_buffer, temp); #else