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()
317317 {
318318 Initialize ( setSysArgv : false , mode : ShutdownMode . Extension ) ;
319319
320+ Finalizer . Instance . ErrorHandler += AllowLeaksDuringShutdown ;
321+
320322 // Trickery - when the import hook is installed into an already
321323 // running Python, the standard import machinery is still in
322324 // control for the duration of the import that caused bootstrap.
@@ -358,6 +360,14 @@ public static IntPtr InitExt()
358360 . DangerousMoveToPointerOrNull ( ) ;
359361 }
360362
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+
361371 /// <summary>
362372 /// Shutdown Method
363373 /// </summary>
You can’t perform that action at this time.
0 commit comments