Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly close OutStream and various fixes #1305

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

limwz01
Copy link

@limwz01 limwz01 commented Dec 12, 2024

In order to support proper execution after resuming from an embedded kernel, we have to make sure that we can revert the IO alterations by the kernelapp using the close() method. The following fixes were made:

  • Call close before embed returns
  • Don't write the extra character on OutStream close() to pipe for watching thread if it's already dead or missing
  • Add new variable closed so that "close" can be called multiple times without any error
  • Don't use __stdout__ and __stderr__ at all
  • Keep blackhole reference around so that the watching thread's pipe file descriptors do not get accidentally closed when the object is garbage collected (it happens now because it is not stored in __stdout__)
  • Keep old IO variables and restore them when exiting
  • More robust StreamHandler fixup and restore (but I think these should actually be completely removed)

@limwz01
Copy link
Author

limwz01 commented Dec 12, 2024

Fixes #1283

@limwz01
Copy link
Author

limwz01 commented Dec 18, 2024

I have no idea why the tests are failing and I currently do not have the appropriate python version to run the tests. But I'll work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant