@@ -832,7 +832,7 @@ internal static unsafe long Refcount(IntPtr op)
832
832
833
833
internal static IntPtr PyThreadState_Swap ( IntPtr key ) => Delegates . PyThreadState_Swap ( key ) ;
834
834
835
-
835
+ internal static int PyGILState_Check ( ) => Delegates . PyGILState_Check ( ) ;
836
836
internal static IntPtr PyGILState_Ensure ( ) => Delegates . PyGILState_Ensure ( ) ;
837
837
838
838
@@ -2302,6 +2302,14 @@ static Delegates()
2302
2302
PyThread_get_thread_ident = ( delegate * unmanaged[ Cdecl] < int > ) GetFunctionByName ( nameof ( PyThread_get_thread_ident ) , GetUnmanagedDll ( _PythonDll ) ) ;
2303
2303
PyThread_set_key_value = ( delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , int > ) GetFunctionByName ( nameof ( PyThread_set_key_value ) , GetUnmanagedDll ( _PythonDll ) ) ;
2304
2304
PyThreadState_Swap = ( delegate * unmanaged[ Cdecl] < IntPtr , IntPtr > ) GetFunctionByName ( nameof ( PyThreadState_Swap ) , GetUnmanagedDll ( _PythonDll ) ) ;
2305
+ try
2306
+ {
2307
+ PyGILState_Check = ( delegate * unmanaged[ Cdecl] < int > ) GetFunctionByName ( nameof ( PyGILState_Check ) , GetUnmanagedDll ( _PythonDll ) ) ;
2308
+ }
2309
+ catch ( MissingMethodException e )
2310
+ {
2311
+ throw new NotSupportedException ( Util . MinimalPythonVersionRequired , innerException : e ) ;
2312
+ }
2305
2313
PyGILState_Ensure = ( delegate * unmanaged[ Cdecl] < IntPtr > ) GetFunctionByName ( nameof ( PyGILState_Ensure ) , GetUnmanagedDll ( _PythonDll ) ) ;
2306
2314
PyGILState_Release = ( delegate * unmanaged[ Cdecl] < IntPtr , void > ) GetFunctionByName ( nameof ( PyGILState_Release ) , GetUnmanagedDll ( _PythonDll ) ) ;
2307
2315
PyGILState_GetThisThreadState = ( delegate * unmanaged[ Cdecl] < IntPtr > ) GetFunctionByName ( nameof ( PyGILState_GetThisThreadState ) , GetUnmanagedDll ( _PythonDll ) ) ;
@@ -2605,6 +2613,7 @@ static Delegates()
2605
2613
internal static delegate * unmanaged[ Cdecl] < int > PyThread_get_thread_ident { get ; }
2606
2614
internal static delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , int > PyThread_set_key_value { get ; }
2607
2615
internal static delegate * unmanaged[ Cdecl] < IntPtr , IntPtr > PyThreadState_Swap { get ; }
2616
+ internal static delegate * unmanaged[ Cdecl] < int > PyGILState_Check { get ; }
2608
2617
internal static delegate * unmanaged[ Cdecl] < IntPtr > PyGILState_Ensure { get ; }
2609
2618
internal static delegate * unmanaged[ Cdecl] < IntPtr , void > PyGILState_Release { get ; }
2610
2619
internal static delegate * unmanaged[ Cdecl] < IntPtr > PyGILState_GetThisThreadState { get ; }
0 commit comments