File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -317,6 +317,8 @@ public static IntPtr InitExt()
317
317
{
318
318
Initialize ( setSysArgv : false , mode : ShutdownMode . Extension ) ;
319
319
320
+ Finalizer . Instance . ErrorHandler += AllowLeaksDuringShutdown ;
321
+
320
322
// Trickery - when the import hook is installed into an already
321
323
// running Python, the standard import machinery is still in
322
324
// control for the duration of the import that caused bootstrap.
@@ -358,6 +360,14 @@ public static IntPtr InitExt()
358
360
. DangerousMoveToPointerOrNull ( ) ;
359
361
}
360
362
363
+ private static void AllowLeaksDuringShutdown ( object sender , Finalizer . ErrorArgs e )
364
+ {
365
+ if ( e . Error is RuntimeShutdownException )
366
+ {
367
+ e . Handled = true ;
368
+ }
369
+ }
370
+
361
371
/// <summary>
362
372
/// Shutdown Method
363
373
/// </summary>
You can’t perform that action at this time.
0 commit comments