|
1 | | -using System.Reflection.Emit; |
2 | 1 | using System; |
| 2 | +using System.Diagnostics; |
3 | 3 | using System.Diagnostics.Contracts; |
4 | 4 | using System.Runtime.InteropServices; |
5 | | -using System.Security; |
6 | 5 | using System.Text; |
7 | 6 | using System.Threading; |
8 | 7 | using System.Collections.Generic; |
@@ -1127,13 +1126,18 @@ internal static int PyObject_Compare(IntPtr value1, IntPtr value2) |
1127 | 1126 | internal static nint PyObject_Hash(IntPtr op) => Delegates.PyObject_Hash(op); |
1128 | 1127 |
|
1129 | 1128 |
|
1130 | | - internal static IntPtr PyObject_Repr(IntPtr pointer) => Delegates.PyObject_Repr(pointer); |
1131 | | - |
1132 | | - |
1133 | | - internal static IntPtr PyObject_Str(IntPtr pointer) => Delegates.PyObject_Str(pointer); |
| 1129 | + internal static IntPtr PyObject_Repr(IntPtr pointer) |
| 1130 | + { |
| 1131 | + Debug.Assert(PyErr_Occurred() == IntPtr.Zero); |
| 1132 | + return Delegates.PyObject_Repr(pointer); |
| 1133 | + } |
1134 | 1134 |
|
1135 | 1135 |
|
1136 | | - internal static IntPtr PyObject_Unicode(IntPtr pointer) => Delegates.PyObject_Unicode(pointer); |
| 1136 | + internal static IntPtr PyObject_Str(IntPtr pointer) |
| 1137 | + { |
| 1138 | + Debug.Assert(PyErr_Occurred() == IntPtr.Zero); |
| 1139 | + return Delegates.PyObject_Str(pointer); |
| 1140 | + } |
1137 | 1141 |
|
1138 | 1142 |
|
1139 | 1143 | internal static IntPtr PyObject_Dir(IntPtr pointer) => Delegates.PyObject_Dir(pointer); |
@@ -2322,7 +2326,6 @@ static Delegates() |
2322 | 2326 | PyObject_Hash = (delegate* unmanaged[Cdecl]<IntPtr, IntPtr>)GetFunctionByName(nameof(PyObject_Hash), GetUnmanagedDll(_PythonDll)); |
2323 | 2327 | PyObject_Repr = (delegate* unmanaged[Cdecl]<IntPtr, IntPtr>)GetFunctionByName(nameof(PyObject_Repr), GetUnmanagedDll(_PythonDll)); |
2324 | 2328 | PyObject_Str = (delegate* unmanaged[Cdecl]<IntPtr, IntPtr>)GetFunctionByName(nameof(PyObject_Str), GetUnmanagedDll(_PythonDll)); |
2325 | | - PyObject_Unicode = (delegate* unmanaged[Cdecl]<IntPtr, IntPtr>)GetFunctionByName("PyObject_Str", GetUnmanagedDll(_PythonDll)); |
2326 | 2329 | PyObject_Dir = (delegate* unmanaged[Cdecl]<IntPtr, IntPtr>)GetFunctionByName(nameof(PyObject_Dir), GetUnmanagedDll(_PythonDll)); |
2327 | 2330 | PyObject_GetBuffer = (delegate* unmanaged[Cdecl]<IntPtr, ref Py_buffer, int, int>)GetFunctionByName(nameof(PyObject_GetBuffer), GetUnmanagedDll(_PythonDll)); |
2328 | 2331 | PyBuffer_Release = (delegate* unmanaged[Cdecl]<ref Py_buffer, void>)GetFunctionByName(nameof(PyBuffer_Release), GetUnmanagedDll(_PythonDll)); |
@@ -2607,7 +2610,6 @@ static Delegates() |
2607 | 2610 | internal static delegate* unmanaged[Cdecl]<IntPtr, IntPtr> PyObject_Hash { get; } |
2608 | 2611 | internal static delegate* unmanaged[Cdecl]<IntPtr, IntPtr> PyObject_Repr { get; } |
2609 | 2612 | internal static delegate* unmanaged[Cdecl]<IntPtr, IntPtr> PyObject_Str { get; } |
2610 | | - internal static delegate* unmanaged[Cdecl]<IntPtr, IntPtr> PyObject_Unicode { get; } |
2611 | 2613 | internal static delegate* unmanaged[Cdecl]<IntPtr, IntPtr> PyObject_Dir { get; } |
2612 | 2614 | internal static delegate* unmanaged[Cdecl]<IntPtr, ref Py_buffer, int, int> PyObject_GetBuffer { get; } |
2613 | 2615 | internal static delegate* unmanaged[Cdecl]<ref Py_buffer, void> PyBuffer_Release { get; } |
|
0 commit comments