python-3.6 test by stonebig · Pull Request #307 · pythonnet/pythonnet

Generating interop36.cs requires clang.

Besides that:

diff --git a/src/clrmodule/ClrModule.cs b/src/clrmodule/ClrModule.cs
index 62fdf49..b90df48 100644
--- a/src/clrmodule/ClrModule.cs
+++ b/src/clrmodule/ClrModule.cs
@@ -26,7 +26,7 @@ using System;
 
 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 class clrModule
 #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 class clrModule
         // 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 1170efe..de0003c 100644
--- a/src/runtime/converter.cs
+++ b/src/runtime/converter.cs
@@ -84,7 +84,7 @@ namespace Python.Runtime
             {
                 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 @@ namespace Python.Runtime
                     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 @@ namespace Python.Runtime
                     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 @@ namespace Python.Runtime
                     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 @@ namespace Python.Runtime
                     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 54c4178..19bbbe0 100644
--- a/src/runtime/delegateobject.cs
+++ b/src/runtime/delegateobject.cs
@@ -102,7 +102,7 @@ namespace Python.Runtime
         //====================================================================
         // 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 48f4095..30c8c7e 100644
--- a/src/runtime/exceptions.cs
+++ b/src/runtime/exceptions.cs
@@ -84,7 +84,7 @@ namespace Python.Runtime
 
         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 @@ namespace Python.Runtime
            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 @@ namespace Python.Runtime
         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 8f8f032..7ebb13b 100644
--- a/src/runtime/importhook.cs
+++ b/src/runtime/importhook.cs
@@ -14,7 +14,7 @@ namespace Python.Runtime
         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 @@ namespace Python.Runtime
             // 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 @@ namespace Python.Runtime
 
             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 @@ namespace Python.Runtime
 
         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 @@ namespace Python.Runtime
         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 7288ff5..fa5c258 100644
--- a/src/runtime/interop.cs
+++ b/src/runtime/interop.cs
@@ -156,7 +156,7 @@ namespace Python.Runtime
         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 @@ namespace Python.Runtime
     }
 
 
-#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35)
+#if (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36)
     [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
     internal class BytesOffset
     {
@@ -292,10 +292,10 @@ namespace Python.Runtime
         /* 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 @@ namespace Python.Runtime
 #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 @@ namespace Python.Runtime
             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 @@ namespace Python.Runtime
             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 @@ namespace Python.Runtime
             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 a0f0f31..d80ae84 100644
--- a/src/runtime/interop35.cs
+++ b/src/runtime/interop35.cs
@@ -3,7 +3,7 @@
 
 
 
-#if (PYTHON35)
+#if (PYTHON35 || PYTHON36)
 using System;
 using System.Collections;
 using System.Collections.Specialized;
diff --git a/src/runtime/pythonengine.cs b/src/runtime/pythonengine.cs
index 70a1c55..f00e4f7 100644
--- a/src/runtime/pythonengine.cs
+++ b/src/runtime/pythonengine.cs
@@ -186,7 +186,7 @@ namespace Python.Runtime
         // 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 @@ namespace Python.Runtime
             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 7f51230..d88c30f 100644
--- a/src/runtime/runtime.cs
+++ b/src/runtime/runtime.cs
@@ -7,7 +7,7 @@ using Mono.Unix;
 
 #endif
 
-#if (UCS2 && (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35))
+#if (UCS2 && (PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36))
 using System.Text;
 #endif
 
@@ -139,8 +139,12 @@ namespace Python.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 @@ namespace Python.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 @@ namespace Python.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 @@ namespace Python.Runtime
                 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 @@ namespace Python.Runtime
             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 @@ namespace Python.Runtime
             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 @@ namespace Python.Runtime
             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 @@ namespace Python.Runtime
 
             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 @@ namespace Python.Runtime
         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 @@ namespace Python.Runtime
         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 @@ namespace Python.Runtime
             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 @@ namespace Python.Runtime
         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 @@ namespace Python.Runtime
         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 @@ namespace Python.Runtime
         // 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 @@ namespace Python.Runtime
             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 @@ namespace Python.Runtime
             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 @@ namespace Python.Runtime
         }
     }
 
-#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 @@ namespace Python.Runtime
         }
 
 #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 @@ namespace Python.Runtime
         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 @@ namespace Python.Runtime
 
 #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 @@ namespace Python.Runtime
             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 @@ namespace Python.Runtime
         // 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 @@ namespace Python.Runtime
         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 ecac920..6f1eb60 100644
--- a/src/runtime/typemanager.cs
+++ b/src/runtime/typemanager.cs
@@ -407,7 +407,7 @@ namespace Python.Runtime
             // 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 @@ namespace Python.Runtime
             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 @@ namespace Python.Runtime
             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