@@ -832,7 +832,7 @@ internal static unsafe long Refcount(IntPtr op)
832832
833833 internal static IntPtr PyThreadState_Swap ( IntPtr key ) => Delegates . PyThreadState_Swap ( key ) ;
834834
835-
835+ internal static int PyGILState_Check ( ) => Delegates . PyGILState_Check ( ) ;
836836 internal static IntPtr PyGILState_Ensure ( ) => Delegates . PyGILState_Ensure ( ) ;
837837
838838
@@ -2302,6 +2302,14 @@ static Delegates()
23022302 PyThread_get_thread_ident = ( delegate * unmanaged[ Cdecl] < int > ) GetFunctionByName ( nameof ( PyThread_get_thread_ident ) , GetUnmanagedDll ( _PythonDll ) ) ;
23032303 PyThread_set_key_value = ( delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , int > ) GetFunctionByName ( nameof ( PyThread_set_key_value ) , GetUnmanagedDll ( _PythonDll ) ) ;
23042304 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+ }
23052313 PyGILState_Ensure = ( delegate * unmanaged[ Cdecl] < IntPtr > ) GetFunctionByName ( nameof ( PyGILState_Ensure ) , GetUnmanagedDll ( _PythonDll ) ) ;
23062314 PyGILState_Release = ( delegate * unmanaged[ Cdecl] < IntPtr , void > ) GetFunctionByName ( nameof ( PyGILState_Release ) , GetUnmanagedDll ( _PythonDll ) ) ;
23072315 PyGILState_GetThisThreadState = ( delegate * unmanaged[ Cdecl] < IntPtr > ) GetFunctionByName ( nameof ( PyGILState_GetThisThreadState ) , GetUnmanagedDll ( _PythonDll ) ) ;
@@ -2605,6 +2613,7 @@ static Delegates()
26052613 internal static delegate * unmanaged[ Cdecl] < int > PyThread_get_thread_ident { get ; }
26062614 internal static delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , int > PyThread_set_key_value { get ; }
26072615 internal static delegate * unmanaged[ Cdecl] < IntPtr , IntPtr > PyThreadState_Swap { get ; }
2616+ internal static delegate * unmanaged[ Cdecl] < int > PyGILState_Check { get ; }
26082617 internal static delegate * unmanaged[ Cdecl] < IntPtr > PyGILState_Ensure { get ; }
26092618 internal static delegate * unmanaged[ Cdecl] < IntPtr , void > PyGILState_Release { get ; }
26102619 internal static delegate * unmanaged[ Cdecl] < IntPtr > PyGILState_GetThisThreadState { get ; }
0 commit comments