@@ -227,9 +227,6 @@ internal static void Initialize(bool initSigs = false, bool softShutdown = false
227
227
228
228
SetPyMember ( ref PySuper_Type , PyObject_GetAttrString ( builtins , "super" ) ) ;
229
229
230
- op = PyObject_GetAttrString ( builtins , "KeyError" ) ;
231
- SetPyMember ( ref PyExc_KeyError , op ) ;
232
-
233
230
XDecref ( builtins ) ;
234
231
}
235
232
@@ -345,6 +342,7 @@ private static void InitializePlatformData()
345
342
346
343
fn = PyObject_GetAttrString ( platformModule , "system" ) ;
347
344
op = PyObject_Call ( fn , emptyTuple , IntPtr . Zero ) ;
345
+ PythonException . ThrowIfIsNull ( op ) ;
348
346
OperatingSystemName = GetManagedString ( op ) ;
349
347
XDecref ( op ) ;
350
348
XDecref ( fn ) ;
@@ -470,7 +468,7 @@ private static void PyDictTryDelItem(IntPtr dict, string key)
470
468
{
471
469
return ;
472
470
}
473
- if ( ! PythonException . Matches ( PyExc_KeyError ) )
471
+ if ( ! PythonException . Matches ( Exceptions . KeyError ) )
474
472
{
475
473
throw new PythonException ( ) ;
476
474
}
@@ -541,8 +539,6 @@ private static void MoveClrInstancesOnwershipToPython()
541
539
internal static IntPtr PyNone ;
542
540
internal static IntPtr Error ;
543
541
544
- internal static IntPtr PyExc_KeyError ;
545
-
546
542
/// <summary>
547
543
/// Check if any Python Exceptions occurred.
548
544
/// If any exist throw new PythonException.
0 commit comments