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

Skip to content

Commit ea98492

Browse files
committed
The library is always loaded in memory
Remove the `ifdef`s We also build for python 3.7.
1 parent f657173 commit ea98492

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/runtime/Python.Runtime.15.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">$(DefineConstants);PYTHON2;$(Python2Version);$(PythonWinDefineConstants)</DefineConstants>
8585
</PropertyGroup>
8686
<PropertyGroup Condition=" '$(Configuration)' == 'ReleaseWinPY3'">
87-
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">$(DefineConstants);PYTHON3;$(Python3Version);$(PythonWinDefineConstants)</DefineConstants>
87+
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">TRACE;XPLAT;;PYTHON3;PYTHON37;UCS2</DefineConstants>
8888
</PropertyGroup>
8989
<PropertyGroup Condition=" '$(Configuration)' == 'DebugWin'">
9090
<DefineConstants Condition="'$(CustomDefineConstants)' == ''">$(DefineConstants);PYTHON2;$(Python2Version);$(PythonWinDefineConstants);FINALIZER_CHECK;TRACE;DEBUG</DefineConstants>

src/runtime/runtime.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,8 @@ public class Runtime
9595

9696
public static readonly string PythonDLL = _PythonDll;
9797

98-
#if PYTHON_WITHOUT_ENABLE_SHARED && !NETSTANDARD
98+
// In Unity, the library is always loaded in-memory
9999
internal const string _PythonDll = "__Internal";
100-
#else
101-
internal const string _PythonDll = dllBase + dllWithPyDebug + dllWithPyMalloc;
102-
#endif
103100
#if MONO_LINUX
104101
internal const string dllDirectory = "Library/conda/lib/";
105102
internal const string pythonlib = "python3.7m";
@@ -1045,7 +1042,10 @@ internal static int PyObject_Compare(IntPtr value1, IntPtr value2)
10451042
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)]
10461043
internal static extern int PyCallable_Check(IntPtr pointer);
10471044

1048-
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)]
1045+
// [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "PyObject_IsTrue")]
1046+
// internal static extern int _PyObject_IsTrue(IntPtr pointer);
1047+
// internal static int PyObject_IsTrue(IntPtr ptr) => _PyObject_IsTrue(ptr);
1048+
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "PyObject_IsTrue")]
10491049
internal static extern int PyObject_IsTrue(IntPtr pointer);
10501050

10511051
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)]
@@ -1058,7 +1058,6 @@ internal static long PyObject_Size(IntPtr pointer)
10581058

10591059
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "PyObject_Size")]
10601060
private static extern IntPtr _PyObject_Size(IntPtr pointer);
1061-
10621061
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)]
10631062
internal static extern IntPtr PyObject_Hash(IntPtr op);
10641063

0 commit comments

Comments
 (0)