File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,13 @@ static Delegates()
25
25
PyThreadState_Get = ( delegate * unmanaged[ Cdecl] < PyThreadState * > ) GetFunctionByName ( nameof ( PyThreadState_Get ) , GetUnmanagedDll ( _PythonDll ) ) ;
26
26
try
27
27
{
28
- _PyThreadState_UncheckedGet = ( delegate * unmanaged[ Cdecl] < PyThreadState * > ) GetFunctionByName ( nameof ( _PyThreadState_UncheckedGet ) , GetUnmanagedDll ( _PythonDll ) ) ;
28
+ // Up until Python 3.13, this function was private
29
+ PyThreadState_UncheckedGet = ( delegate * unmanaged[ Cdecl] < PyThreadState * > ) GetFunctionByName ( "_PyThreadState_UncheckedGet" , GetUnmanagedDll ( _PythonDll ) ) ;
29
30
}
30
31
catch ( MissingMethodException )
31
32
{
32
- // Not supported in Python 3.13 anymore
33
+
34
+ PyThreadState_UncheckedGet = ( delegate * unmanaged[ Cdecl] < PyThreadState * > ) GetFunctionByName ( nameof ( PyThreadState_UncheckedGet ) , GetUnmanagedDll ( _PythonDll ) ) ;
33
35
}
34
36
try
35
37
{
@@ -321,7 +323,7 @@ static Delegates()
321
323
internal static delegate * unmanaged[ Cdecl] < PyThreadState * , void > Py_EndInterpreter { get ; }
322
324
internal static delegate * unmanaged[ Cdecl] < PyInterpreterState * , PyThreadState * > PyThreadState_New { get ; }
323
325
internal static delegate * unmanaged[ Cdecl] < PyThreadState * > PyThreadState_Get { get ; }
324
- internal static delegate * unmanaged[ Cdecl] < PyThreadState * > _PyThreadState_UncheckedGet { get ; }
326
+ internal static delegate * unmanaged[ Cdecl] < PyThreadState * > PyThreadState_UncheckedGet { get ; }
325
327
internal static delegate * unmanaged[ Cdecl] < int > PyGILState_Check { get ; }
326
328
internal static delegate * unmanaged[ Cdecl] < PyGILState > PyGILState_Ensure { get ; }
327
329
internal static delegate * unmanaged[ Cdecl] < PyGILState , void > PyGILState_Release { get ; }
Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ internal static void Shutdown()
316
316
// Then release the GIL for good, if there is somehting to release
317
317
// Use the unchecked version as the checked version calls `abort()`
318
318
// if the current state is NULL.
319
- if ( _PyThreadState_UncheckedGet ( ) != ( PyThreadState * ) 0 )
319
+ if ( PyThreadState_UncheckedGet ( ) != ( PyThreadState * ) 0 )
320
320
{
321
321
PyEval_SaveThread ( ) ;
322
322
}
@@ -705,7 +705,7 @@ internal static T TryUsingDll<T>(Func<T> op)
705
705
internal static PyThreadState * PyThreadState_Get ( ) => Delegates . PyThreadState_Get ( ) ;
706
706
707
707
708
- internal static PyThreadState * _PyThreadState_UncheckedGet ( ) => Delegates . _PyThreadState_UncheckedGet ( ) ;
708
+ internal static PyThreadState * PyThreadState_UncheckedGet ( ) => Delegates . PyThreadState_UncheckedGet ( ) ;
709
709
710
710
711
711
internal static int PyGILState_Check ( ) => Delegates . PyGILState_Check ( ) ;
You can’t perform that action at this time.
0 commit comments