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()
2525 PyThreadState_Get = ( delegate * unmanaged[ Cdecl] < PyThreadState * > ) GetFunctionByName ( nameof ( PyThreadState_Get ) , GetUnmanagedDll ( _PythonDll ) ) ;
2626 try
2727 {
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 ) ) ;
2930 }
3031 catch ( MissingMethodException )
3132 {
32- // Not supported in Python 3.13 anymore
33+
34+ PyThreadState_UncheckedGet = ( delegate * unmanaged[ Cdecl] < PyThreadState * > ) GetFunctionByName ( nameof ( PyThreadState_UncheckedGet ) , GetUnmanagedDll ( _PythonDll ) ) ;
3335 }
3436 try
3537 {
@@ -321,7 +323,7 @@ static Delegates()
321323 internal static delegate * unmanaged[ Cdecl] < PyThreadState * , void > Py_EndInterpreter { get ; }
322324 internal static delegate * unmanaged[ Cdecl] < PyInterpreterState * , PyThreadState * > PyThreadState_New { get ; }
323325 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 ; }
325327 internal static delegate * unmanaged[ Cdecl] < int > PyGILState_Check { get ; }
326328 internal static delegate * unmanaged[ Cdecl] < PyGILState > PyGILState_Ensure { get ; }
327329 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()
316316 // Then release the GIL for good, if there is somehting to release
317317 // Use the unchecked version as the checked version calls `abort()`
318318 // if the current state is NULL.
319- if ( _PyThreadState_UncheckedGet ( ) != ( PyThreadState * ) 0 )
319+ if ( PyThreadState_UncheckedGet ( ) != ( PyThreadState * ) 0 )
320320 {
321321 PyEval_SaveThread ( ) ;
322322 }
@@ -705,7 +705,7 @@ internal static T TryUsingDll<T>(Func<T> op)
705705 internal static PyThreadState * PyThreadState_Get ( ) => Delegates . PyThreadState_Get ( ) ;
706706
707707
708- internal static PyThreadState * _PyThreadState_UncheckedGet ( ) => Delegates . _PyThreadState_UncheckedGet ( ) ;
708+ internal static PyThreadState * PyThreadState_UncheckedGet ( ) => Delegates . PyThreadState_UncheckedGet ( ) ;
709709
710710
711711 internal static int PyGILState_Check ( ) => Delegates . PyGILState_Check ( ) ;
You can’t perform that action at this time.
0 commit comments