Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ dist: xenial
sudo: false
language: python
python:
- 3.9
- 3.8
- 3.7
- 3.6
Expand Down
7 changes: 6 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '{branch}-{build}'
build: off

image:
- Visual Studio 2017
- Visual Studio 2019

platform:
- x86
Expand All @@ -15,15 +15,20 @@ environment:
CODECOV_ENV: PYTHON_VERSION, PLATFORM

matrix:
- PYTHON_VERSION: 3.9
BUILD_OPTS: --xplat
- PYTHON_VERSION: 3.8
BUILD_OPTS: --xplat
- PYTHON_VERSION: 3.7
BUILD_OPTS: --xplat
- PYTHON_VERSION: 3.6
BUILD_OPTS: --xplat
- PYTHON_VERSION: 3.9
- PYTHON_VERSION: 3.8
- PYTHON_VERSION: 3.7
- PYTHON_VERSION: 3.6
- PYTHON_VERSION: 3.9
PYTHONNET_SHUTDOWN_MODE: Soft
- PYTHON_VERSION: 3.8
PYTHONNET_SHUTDOWN_MODE: Soft
- PYTHON_VERSION: 3.7
Expand Down
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Requirements for both Travis and AppVeyor
pytest==3.2.5
pytest
coverage
psutil

# Coverage upload
codecov

# Platform specific requirements
# pip; sys_platform == 'win32'
wheel; sys_platform == 'win32'
pycparser; sys_platform != 'win32'
wheel
pycparser
3 changes: 2 additions & 1 deletion src/runtime/Python.Runtime.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -167,6 +167,7 @@
<Compile Include="interop36.cs" />
<Compile Include="interop37.cs" />
<Compile Include="interop38.cs" />
<Compile Include="interop39.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\pythonnet.snk" />
Expand Down
227 changes: 227 additions & 0 deletions src/runtime/interop39.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@

// Auto-generated by geninterop.py.
// DO NOT MODIFY BY HAND.


#if PYTHON39
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)]
internal static partial class TypeOffset
{
// 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_vectorcall_offset = 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 tp_vectorcall = 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;
public static int ht_module = 0;

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

[StructLayout(LayoutKind.Sequential)]
internal struct PyNumberMethods
{
public IntPtr nb_add;
public IntPtr nb_subtract;
public IntPtr nb_multiply;
public IntPtr nb_remainder;
public IntPtr nb_divmod;
public IntPtr nb_power;
public IntPtr nb_negative;
public IntPtr nb_positive;
public IntPtr nb_absolute;
public IntPtr nb_bool;
public IntPtr nb_invert;
public IntPtr nb_lshift;
public IntPtr nb_rshift;
public IntPtr nb_and;
public IntPtr nb_xor;
public IntPtr nb_or;
public IntPtr nb_int;
public IntPtr nb_reserved;
public IntPtr nb_float;
public IntPtr nb_inplace_add;
public IntPtr nb_inplace_subtract;
public IntPtr nb_inplace_multiply;
public IntPtr nb_inplace_remainder;
public IntPtr nb_inplace_power;
public IntPtr nb_inplace_lshift;
public IntPtr nb_inplace_rshift;
public IntPtr nb_inplace_and;
public IntPtr nb_inplace_xor;
public IntPtr nb_inplace_or;
public IntPtr nb_floor_divide;
public IntPtr nb_true_divide;
public IntPtr nb_inplace_floor_divide;
public IntPtr nb_inplace_true_divide;
public IntPtr nb_index;
public IntPtr nb_matrix_multiply;
public IntPtr nb_inplace_matrix_multiply;
}

[StructLayout(LayoutKind.Sequential)]
internal struct PySequenceMethods
{
public IntPtr sq_length;
public IntPtr sq_concat;
public IntPtr sq_repeat;
public IntPtr sq_item;
public IntPtr was_sq_slice;
public IntPtr sq_ass_item;
public IntPtr was_sq_ass_slice;
public IntPtr sq_contains;
public IntPtr sq_inplace_concat;
public IntPtr sq_inplace_repeat;
}

[StructLayout(LayoutKind.Sequential)]
internal struct PyMappingMethods
{
public IntPtr mp_length;
public IntPtr mp_subscript;
public IntPtr mp_ass_subscript;
}

[StructLayout(LayoutKind.Sequential)]
internal struct PyAsyncMethods
{
public IntPtr am_await;
public IntPtr am_aiter;
public IntPtr am_anext;
}

[StructLayout(LayoutKind.Sequential)]
internal struct PyBufferProcs
{
public IntPtr bf_getbuffer;
public IntPtr bf_releasebuffer;
}

internal static partial class SlotTypes
{
public static readonly Type[] Types = {
typeof(PyNumberMethods),
typeof(PySequenceMethods),
typeof(PyMappingMethods),
typeof(PyAsyncMethods),
typeof(PyBufferProcs),
};
}

}
#endif
10 changes: 6 additions & 4 deletions src/runtime/runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ public class Runtime
const string _minor = "7";
#elif PYTHON38
const string _minor = "8";
#elif PYTHON39
const string _minor = "9";
#else
#error You must define one of PYTHON36 to PYTHON38
#error You must define one of PYTHON36 to PYTHON39
#endif

#if WINDOWS
Expand Down Expand Up @@ -123,7 +125,7 @@ internal static Version PyVersion
/// <summary>
/// Initialize the runtime...
/// </summary>
/// <remarks>Always call this method from the Main thread. After the
/// <remarks>Always call this method from the Main thread. After the
/// first call to this method, the main thread has acquired the GIL.</remarks>
internal static void Initialize(bool initSigs = false, ShutdownMode mode = ShutdownMode.Default)
{
Expand Down Expand Up @@ -405,7 +407,7 @@ internal static void Shutdown(ShutdownMode mode)
{
PyEval_SaveThread();
}

}
else
{
Expand Down Expand Up @@ -1721,7 +1723,7 @@ internal static long PyDict_Size(IntPtr pointer)
internal static extern int PySet_Add(IntPtr set, IntPtr key);

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