Skip to content

Commit 65cb22e

Browse files
committed
Don't call exit functions on soft or reload shutdown
This fixes the exit functions being called during soft shutdown or reload shutdown. Also a small improvement to readability in Runtime.Shutdown.
1 parent 5ac75ba commit 65cb22e

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/runtime/runtime.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ internal static void Shutdown()
317317
PyGILState_Ensure();
318318

319319
var mode = ShutdownMode;
320-
if (mode != ShutdownMode.Normal)
320+
if (mode == ShutdownMode.Normal)
321321
{
322322
RunExitFuncs();
323323
}
@@ -361,10 +361,12 @@ internal static void Shutdown()
361361
// Some clr runtime didn't implement GC.WaitForFullGCComplete yet.
362362
}
363363
PyEval_SaveThread();
364-
return;
365364
}
366-
ResetPyMembers();
367-
Py_Finalize();
365+
else
366+
{
367+
ResetPyMembers();
368+
Py_Finalize();
369+
}
368370
}
369371

370372
internal static ShutdownMode GetDefaultShutdownMode()

0 commit comments

Comments
 (0)