« Back to Search  |  Reader Mode  |  Switch to Full Retro Site View Links: Stay in Reader  |  Retro Mode: ON  |  Original »
GitHub · Extracted in 1062 ms

Split from PR 958: restoring the __import__ after shutdown. by benoithudson · Pull Request #993 · pythonnet/pythonnet

Source: https://github.com/pythonnet/pythonnet/pull/993

Repository navigation

Split from PR 958: restoring the __import__ after shutdown. - #993


Merged
filmor merged 1 commit into pythonnet:master from Unity-Technologies:958-import-hook Nov 21, 2019
Merged

Split from PR 958: restoring the __import__ after shutdown. #993 filmor merged 1 commit into pythonnet:master from Unity-Technologies:958-import-hook

Conversation

benoithudson commented Nov 21, 2019 · edited Loading



Copy link Copy Markdown
Contributor

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.

  • Make sure to include one or more tests for your change

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.

  • If an enhancement PR, please create docs and at best an example
  • Add yourself to AUTHORS
  • Updated the CHANGELOG
Split from PR 958: restoring the __import__ after shutdown. 668c590
When C# shuts down we should restore Python to its original state.

codecov-io commented Nov 21, 2019 · edited Loading



Copy link Copy Markdown

Codecov Report

Merging #993 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #993   +/-   ##
=======================================
  Coverage   86.71%   86.71%           
=======================================
  Files           1        1           
  Lines         301      301           
=======================================
  Hits          261      261           
  Misses         40       40
Flag Coverage Δ
#setup_linux 65.44% <ø> (ø) ⬆️
#setup_windows 71.42% <ø> (ø) ⬆️

Continue to review full report at Codecov .

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov . Last update 2736094...668c590 . Read the comment docs .

filmor merged commit 5f2e2e2 into pythonnet : master Nov 21, 2019

filmor commented Nov 21, 2019



Copy link Copy Markdown
Member

Nice, thank you very much :)

benoithudson deleted the 958-import-hook branch November 21, 2019 15:41 benoithudson mentioned this pull request Nov 21, 2019 Add soft shutdown #958 Merged 4 tasks AlexCatarino pushed a commit to QuantConnect/pythonnet that referenced this pull request Jun 27, 2020 Split from PR 958: restoring the __import__ after shutdown. (pythonne... 4e4b41c
...t#993)

When C# shuts down we should restore Python to its original state.
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

3 participants