Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 src/runtime/pythonengine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ static void OnDomainUnload(object _, EventArgs __)

static void OnProcessExit(object _, EventArgs __)
{
Runtime.ProcessIsTerminating = true;
Shutdown();
}

Expand Down
3 changes: 2 additions & 1 deletion 3 src/runtime/runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ internal static int GetRun()
}

internal static bool HostedInPython;
internal static bool ProcessIsTerminating;

/// Initialize the runtime...
/// </summary>
Expand Down Expand Up @@ -254,7 +255,7 @@ internal static void Shutdown()

var state = PyGILState_Ensure();

if (!HostedInPython)
if (!HostedInPython && !ProcessIsTerminating)
{
// avoid saving dead objects
TryCollectingGarbage(runs: 3);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.