- Notifications
You must be signed in to change notification settings - Fork749
Split from PR 958: restoring the __import__ after shutdown.#993
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
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
When C# shuts down we should restore Python to its original state.
codecov-io commentedNov 21, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## master #993 +/- ##======================================= Coverage 86.71% 86.71% ======================================= Files 1 1 Lines 301 301 ======================================= Hits 261 261 Misses 40 40
Continue to review full report at Codecov.
|
Nice, thank you very much :) |
AlexCatarino pushed a commit to QuantConnect/pythonnet that referenced this pull requestJun 27, 2020
…t#993)When C# shuts down we should restore Python to its original state.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading.Please reload this page.
When C# shuts down we should restore Python to its original state.
What does this implement/fix? Explain your changes.
This is adapted from the large patch that amos put in PR#958. It restores the import hook.
Does this close any currently open issues?
Not yet.
Any other comments?
I would have used the ShutdownHandler but that's only in the PythonEngine, whereas
__import__
is in the Runtime. Maybe we should move the ShutdownHandler mechanism to the runtime?Checklist
Check all those that are applicable and complete.
Can't really test this at the moment. After Py_Finalize (in Shutdown), we can't check the state of the
__import__
function until we call Py_Initialize. But Py_Initialize will create a new__import__
, so we can't see whether our code ran. This change only becomes relevant when we stop calling Py_Finalize in Shutdown.AUTHORS
CHANGELOG