- Notifications
You must be signed in to change notification settings - Fork749
Handle ProcessExit event#1458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@@ -393,6 +393,10 @@ internal static void Shutdown(ShutdownMode mode) | |||
{ | |||
Py_Finalize(); | |||
} | |||
else | |||
{ | |||
PyGILState_Release(state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This change seems unrelated, why did you add this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Without thisPy_Finalize
called when Python finally shuts down hangs because it can't acquire GIL.
I debugged the test failures, and they appear to be caused by gaps in domain reload support: when .NET objects that Python sees get severed from CLR, subsequent calls to their |
…r Mono) is unloaded before Python stops
Found a way to solve the same problem and more without handling |
Or maybe not. Seems to still be essential for#1134 |
This avoids segfault when CLR (in particular Mono) is unloaded before Python stops.
What does this implement/fix? Explain your changes.
AppDomain.ProcessExit
, that fires in the situations like this instead ofAppDomain.DomainUnload
. This allows Python.NET to remove all slots, that are implemented in C#.Does this close any currently open issues?
This is (at least one of) the reason of CI test crashes in#1134