@@ -127,7 +127,7 @@ static void SetupImportHook()
127
127
if ( Runtime . PyModule_AddObject ( ClrModuleReference , "loader" , import_hook_module ) != 0 )
128
128
{
129
129
Runtime . XDecref ( import_hook_module . DangerousGetAddress ( ) ) ;
130
- throw new PythonException ( ) ;
130
+ throw PythonException . ThrowLastAsClrException ( ) ;
131
131
}
132
132
133
133
// Finally, add the hook to the meta path
@@ -157,7 +157,7 @@ static void SetupNamespaceTracking()
157
157
{
158
158
if ( Runtime . PySet_Add ( newset , new BorrowedReference ( pyNs ) ) != 0 )
159
159
{
160
- throw new PythonException ( ) ;
160
+ throw PythonException . ThrowLastAsClrException ( ) ;
161
161
}
162
162
}
163
163
finally
@@ -168,7 +168,7 @@ static void SetupNamespaceTracking()
168
168
169
169
if ( Runtime . PyDict_SetItemString ( root . dict , availableNsKey , newset . DangerousGetAddress ( ) ) != 0 )
170
170
{
171
- throw new PythonException ( ) ;
171
+ throw PythonException . ThrowLastAsClrException ( ) ;
172
172
}
173
173
}
174
174
finally
@@ -208,7 +208,7 @@ public static void OnNamespaceAdded(string name)
208
208
{
209
209
if ( Runtime . PySet_Add ( nsSet , new BorrowedReference ( pyNs ) ) != 0 )
210
210
{
211
- throw new PythonException ( ) ;
211
+ throw PythonException . ThrowLastAsClrException ( ) ;
212
212
}
213
213
}
214
214
}
@@ -275,7 +275,7 @@ public static ModuleObject Import(string modname)
275
275
if ( ! ( mt is ModuleObject ) )
276
276
{
277
277
Exceptions . SetError ( Exceptions . ImportError , $ "'{ name } ' Is not a ModuleObject.") ;
278
- throw new PythonException ( ) ;
278
+ throw PythonException . ThrowLastAsClrException ( ) ;
279
279
}
280
280
if ( head == null )
281
281
{
0 commit comments