@@ -1009,6 +1009,11 @@ internal static string PyObject_GetTypeName(IntPtr op)
1009
1009
return Marshal . PtrToStringAnsi ( ppName ) ;
1010
1010
}
1011
1011
1012
+ /// <summary>
1013
+ /// Test whether the Python object is an iterable.
1014
+ /// </summary>
1015
+ internal static bool PyObject_IsIterable ( BorrowedReference ob )
1016
+ => PyObject_IsIterable ( ob . DangerousGetAddress ( ) ) ;
1012
1017
/// <summary>
1013
1018
/// Test whether the Python object is an iterable.
1014
1019
/// </summary>
@@ -1078,7 +1083,10 @@ internal static IntPtr PyObject_GetAttr(IntPtr pointer, IntPtr name)
1078
1083
internal static IntPtr PyObject_Call ( IntPtr pointer , IntPtr args , IntPtr kw ) => Delegates . PyObject_Call ( pointer , args , kw ) ;
1079
1084
1080
1085
1081
- internal static IntPtr PyObject_CallObject ( IntPtr pointer , IntPtr args ) => Delegates . PyObject_CallObject ( pointer , args ) ;
1086
+ internal static NewReference PyObject_CallObject ( BorrowedReference callable , BorrowedReference args ) => Delegates . PyObject_CallObject ( callable , args ) ;
1087
+ internal static IntPtr PyObject_CallObject ( IntPtr pointer , IntPtr args )
1088
+ => Delegates . PyObject_CallObject ( new BorrowedReference ( pointer ) , new BorrowedReference ( args ) )
1089
+ . DangerousMoveToPointerOrNull ( ) ;
1082
1090
1083
1091
1084
1092
internal static int PyObject_RichCompareBool ( IntPtr value1 , IntPtr value2 , int opid ) => Delegates . PyObject_RichCompareBool ( value1 , value2 , opid ) ;
@@ -1880,6 +1888,7 @@ internal static IntPtr PyTuple_GetSlice(IntPtr pointer, long start, long end)
1880
1888
//====================================================================
1881
1889
// Python iterator API
1882
1890
//====================================================================
1891
+ internal static bool PyIter_Check ( BorrowedReference ob ) => PyIter_Check ( ob . DangerousGetAddress ( ) ) ;
1883
1892
1884
1893
internal static bool PyIter_Check ( IntPtr pointer )
1885
1894
{
@@ -2317,7 +2326,7 @@ static Delegates()
2317
2326
PyObject_DelItem = ( delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , int > ) GetFunctionByName ( nameof ( PyObject_DelItem ) , GetUnmanagedDll ( _PythonDll ) ) ;
2318
2327
PyObject_GetIter = ( delegate * unmanaged[ Cdecl] < IntPtr , IntPtr > ) GetFunctionByName ( nameof ( PyObject_GetIter ) , GetUnmanagedDll ( _PythonDll ) ) ;
2319
2328
PyObject_Call = ( delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , IntPtr , IntPtr > ) GetFunctionByName ( nameof ( PyObject_Call ) , GetUnmanagedDll ( _PythonDll ) ) ;
2320
- PyObject_CallObject = ( delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , IntPtr > ) GetFunctionByName ( nameof ( PyObject_CallObject ) , GetUnmanagedDll ( _PythonDll ) ) ;
2329
+ PyObject_CallObject = ( delegate * unmanaged[ Cdecl] < BorrowedReference , BorrowedReference , NewReference > ) GetFunctionByName ( nameof ( PyObject_CallObject ) , GetUnmanagedDll ( _PythonDll ) ) ;
2321
2330
PyObject_RichCompareBool = ( delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , int , int > ) GetFunctionByName ( nameof ( PyObject_RichCompareBool ) , GetUnmanagedDll ( _PythonDll ) ) ;
2322
2331
PyObject_IsInstance = ( delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , int > ) GetFunctionByName ( nameof ( PyObject_IsInstance ) , GetUnmanagedDll ( _PythonDll ) ) ;
2323
2332
PyObject_IsSubclass = ( delegate * unmanaged[ Cdecl] < BorrowedReference , BorrowedReference , int > ) GetFunctionByName ( nameof ( PyObject_IsSubclass ) , GetUnmanagedDll ( _PythonDll ) ) ;
@@ -2616,7 +2625,7 @@ static Delegates()
2616
2625
internal static delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , int > PyObject_DelItem { get ; }
2617
2626
internal static delegate * unmanaged[ Cdecl] < IntPtr , IntPtr > PyObject_GetIter { get ; }
2618
2627
internal static delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , IntPtr , IntPtr > PyObject_Call { get ; }
2619
- internal static delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , IntPtr > PyObject_CallObject { get ; }
2628
+ internal static delegate * unmanaged[ Cdecl] < BorrowedReference , BorrowedReference , NewReference > PyObject_CallObject { get ; }
2620
2629
internal static delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , int , int > PyObject_RichCompareBool { get ; }
2621
2630
internal static delegate * unmanaged[ Cdecl] < IntPtr , IntPtr , int > PyObject_IsInstance { get ; }
2622
2631
internal static delegate * unmanaged[ Cdecl] < BorrowedReference , BorrowedReference , int > PyObject_IsSubclass { get ; }
0 commit comments