8000 Add Python 3.9 interop file · pythonnet/pythonnet@fd4f9bc · GitHub
[go: up one dir, main page]

Skip to content

Commit fd4f9bc

Browse files
committed
Add Python 3.9 interop file
1 parent 34348aa commit fd4f9bc

File tree

3 files changed

+183
-5
lines changed

3 files changed

+183
-5
lines changed

src/runtime/Python.Runtime.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -167,6 +167,7 @@
167167
<Compile Include="interop36.cs" />
168168
<Compile Include="interop37.cs" />
169169
<Compile Include="interop38.cs" />
170+
<Compile Include="interop39.cs" />
170171
</ItemGroup>
171172
<ItemGroup>
172173
<None Include="..\pythonnet.snk" />

src/runtime/interop39.cs

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
2+
// Auto-generated by geninterop.py.
3+
// DO NOT MODIFY BY HAND.
4+
5+
6+
#if PYTHON39
7+
using System;
8+
using System.Collections;
9+
using System.Collections.Specialized;
10+
using System.Runtime.InteropServices;
11+
using System.Reflection;
12+
using System.Text;
13+
14+
namespace Python.Runtime
15+
{
16+
17+
[StructLayout(LayoutKind.Sequential)]
18+
internal static partial class TypeOffset
19+
{
20+
// Auto-generated from PyHeapTypeObject in Python.h
21+
public static int am_await = 0;
22+
public static int am_aiter = 0;
23+
public static int am_anext = 0;
24+
public static int nb_add = 0;
25+
public static int nb_subtract = 0;
26+
public static int nb_multiply = 0;
27+
public static int nb_remainder = 0;
28+
public static int nb_divmod = 0;
29+
public static int nb_power = 0;
30+
public static int nb_negative = 0;
31+
public static int nb_positive = 0;
32+
public static int nb_absolute = 0;
33+
public static int nb_bool = 0;
34+
public static int nb_invert = 0;
35+
public static int nb_lshift = 0;
36+
public static int nb_rshift = 0;
37+
public static int nb_and = 0;
38+
public static int nb_xor = 0;
39+
public static int nb_or = 0;
40+
public static int nb_int = 0;
41+
public static int nb_reserved = 0;
42+
public static int nb_float = 0;
43+
public static int nb_inplace_add = 0;
44+
public static int nb_inplace_subtract = 0;
45+
public static int nb_inplace_multiply = 0;
46+
public static int nb_inplace_remainder = 0;
47+
public static int nb_inplace_power = 0;
48+
public static int nb_inplace_lshift = 0;
49+
public static int nb_inplace_rshift = 0;
50+
public static int nb_inplace_and = 0;
51+
public static int nb_inplace_xor = 0;
52+
public static int nb_inplace_or = 0;
53+
public static int nb_floor_divide = 0;
54+
public static int nb_true_divide = 0;
55+
public static int nb_inplace_floor_divide = 0;
56+
public static int nb_inplace_true_divide = 0;
57+
public static int nb_index = 0;
58+
public static int nb_matrix_multiply = 0;
59+
public static int nb_inplace_matrix_multiply = 0;
60+
public static int mp_length = 0;
61+
public static int mp_subscript = 0;
62+
public static int mp_ass_subscript = 0;
63+
public static int sq_length = 0;
64+
public static int sq_concat = 0;
65+
public static int sq_repeat = 0;
66+
public static int sq_item = 0;
67+
public static int was_sq_slice = 0;
68+
public static int sq_ass_item = 0;
69+
public static int was_sq_ass_slice = 0;
70+
public static int sq_contains = 0;
71+
public static int sq_inplace_concat = 0;
72+
public static int sq_inplace_repeat = 0;
73+
public static int bf_getbuffer = 0;
74+
public static int bf_releasebuffer = 0;
75+
public static int name = 0;
76+
public static int ht_slots = 0;
77+
public static int qualname = 0;
78+
public static int ht_cached_keys = 0;
79+
public static int ht_module = 0;
80+
81+
/* here are optional user slots, followed by the members. */
82+
public static int members = 0;
83+
}
84+
85+
[StructLayout(LayoutKind.Sequential)]
86+
internal struct PyNumberMethods
87+
{
88+
public IntPtr nb_add;
89+
public IntPtr nb_subtract;
90+
public IntPtr nb_multiply;
91+
public IntPtr nb_remainder;
92+
public IntPtr nb_divmod;
93+
public IntPtr nb_power;
94+
public IntPtr nb_negative;
95+
public IntPtr nb_positive;
96+
public IntPtr nb_absolute;
97+
public IntPtr nb_bool;
98+
public IntPtr nb_invert;
99+
public IntPtr nb_lshift;
100+
public IntPtr nb_rshift;
101+
public IntPtr nb_and;
102+
public IntPtr nb_xor;
103+
public IntPtr nb_or;
104+
public IntPtr nb_int;
105+
public IntPtr nb_reserved;
106+
public IntPtr nb_float;
107+
public IntPtr nb_inplace_add;
108+
public IntPtr nb_inplace_subtract;
109+
public IntPtr nb_inplace_multiply;
110+
public IntPtr nb_inplace_remainder;
111+
public IntPtr nb_inplace_power;
112+
public IntPtr nb_inplace_lshift;
113+
public IntPtr nb_inplace_rshift;
114+
public IntPtr nb_inplace_and;
115+
public IntPtr nb_inplace_xor;
116+
public IntPtr nb_inplace_or;
117+
public IntPtr nb_floor_divide;
118+
public IntPtr nb_true_divide;
119+
public IntPtr nb_inplace_floor_divide;
120+
public IntPtr nb_inplace_true_divide;
121+
public IntPtr nb_index;
122+
public IntPtr nb_matrix_multiply;
123+
public IntPtr nb_inplace_matrix_multiply;
124+
}
125+
126+
[StructLayout(LayoutKind.Sequential)]
127+
internal struct PySequenceMethods
128+
{
129+
public IntPtr sq_length;
130+
public IntPtr sq_concat;
131+
public IntPtr sq_repeat;
132+
public IntPtr sq_item;
133+
public IntPtr was_sq_slice;
134+
public IntPtr sq_ass_item;
135+
public IntPtr was_sq_ass_slice;
136+
public IntPtr sq_contains;
137+
public IntPtr sq_inplace_concat;
138+
public IntPtr sq_inplace_repeat;
139+
}
140+
141+
[StructLayout(LayoutKind.Sequential)]
142+
internal struct PyMappingMethods
143+
{
144+
public IntPtr mp_length;
145+
public IntPtr mp_subscript;
146+
public IntPtr mp_ass_subscript;
147+
}
148+
149+
[StructLayout(LayoutKind.Sequential)]
150+
internal struct PyAsyncMethods
151+
{
152+
public IntPtr am_await;
153+
public IntPtr am_aiter;
154+
public IntPtr am_anext;
155+
}
156+
157+
[StructLayout(LayoutKind.Sequential)]
158+
internal struct PyBufferProcs
159+
{
160+
public IntPtr bf_getbuffer;
161+
public IntPtr bf_releasebuffer;
162+
}
163+
164+
internal static partial class SlotTypes
165+
{
166+
public static readonly Type[] Types = {
167+
typeof(PyNumberMethods),
168+
typeof(PySequenceMethods),
169+
typeof(PyMappingMethods),
170+
typeof(PyAsyncMethods),
171+
typeof(PyBufferProcs),
172+
};
173+
}
174+
175+
}
176+
#endif
177+

src/runtime/runtime.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class Runtime
5353
#elif PYTHON39
5454
const string _minor = "9";
5555
#else
56-
#error You must define one of PYTHON36 to PYTHON38
56+
#error You must define one of PYTHON36 to PYTHON39
5757
#endif
5858

5959
#if WINDOWS
@@ -125,7 +125,7 @@ internal static Version PyVersion
125125
/// <summary>
126126
/// Initialize the runtime...
127127
/// </summary>
128-
/// <remarks>Always call this method from the Main thread. After the
128+
/// <remarks>Always call this method from the Main thread. After the
129129
/// first call to this method, the main thread has acquired the GIL.</remarks>
130130
internal static void Initialize(bool initSigs = false, ShutdownMode mode = ShutdownMode.Default)
131131
{
@@ -407,7 +407,7 @@ internal static void Shutdown(ShutdownMode mode)
407407
{
408408
PyEval_SaveThread();
409409
}
410-
410+
411411
}
412412
else
413413
{
@@ -1723,7 +1723,7 @@ internal static long PyDict_Size(IntPtr pointer)
17231723
internal static extern int PySet_Add(IntPtr set, IntPtr key);
17241724

17251725
/// <summary>
1726-
/// Return 1 if found, 0 if not found, and -1 if an error is encountered.
1726+
/// Return 1 if found, 0 if not found, and -1 if an error is encountered.
17271727
/// </summary>
17281728
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)]
17291729
internal static extern int PySet_Contains(IntPtr anyset, IntPtr key);

0 commit comments

Comments
 (0)
0