File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -1128,13 +1128,31 @@ internal static int PyObject_Compare(IntPtr value1, IntPtr value2)
11281128 internal static nint PyObject_Hash ( IntPtr op ) => Delegates . PyObject_Hash ( op ) ;
11291129
11301130
1131- internal static IntPtr PyObject_Repr ( IntPtr pointer ) => Delegates . PyObject_Repr ( pointer ) ;
1131+ internal static IntPtr PyObject_Repr ( IntPtr pointer )
1132+ {
1133+ AssertNoErorSet ( ) ;
11321134
1135+ return Delegates . PyObject_Repr ( pointer ) ;
1136+ }
11331137
11341138 internal static IntPtr PyObject_Str ( IntPtr pointer ) => Delegates . PyObject_Str ( pointer ) ;
11351139
11361140
1137- internal static IntPtr PyObject_Unicode ( IntPtr pointer ) => Delegates . PyObject_Unicode ( pointer ) ;
1141+ internal static IntPtr PyObject_Unicode ( IntPtr pointer )
1142+ {
1143+ AssertNoErorSet ( ) ;
1144+
1145+ return Delegates . PyObject_Unicode ( pointer ) ;
1146+ }
1147+
1148+ [ Conditional ( "DEBUG" ) ]
1149+ internal static void AssertNoErorSet ( )
1150+ {
1151+ if ( Exceptions . ErrorOccurred ( ) )
1152+ throw new InvalidOperationException (
1153+ "Can't call with exception set" ,
1154+ PythonException . FetchCurrent ( ) ) ;
1155+ }
11381156
11391157
11401158 internal static IntPtr PyObject_Dir ( IntPtr pointer ) => Delegates . PyObject_Dir ( pointer ) ;
You can’t perform that action at this time.
0 commit comments