-
Notifications
You must be signed in to change notification settings - Fork 40
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
Flush streams #32
Comments
Unfortunately, the |
Just flushing Adding |
Looks like CPython calls But it doesn't seem to expose a function that does that doesn't exit/cleanup everything. |
PyO3 also tried to work around this problem, by simply executing https://github.com/PyO3/pyo3/blob/072be6ce8376edae60963bf0e6db7c32a28e144d/src/lib.rs#L304-L305 |
Seems like the right thing to do is to call |
Segfault doesn't occur when acquiring the GIL first :) Opened a PR on PyO3: PyO3/pyo3#943 |
Python uses the
stdout
andstderr
FILE*
s from libc, which by default only flush on\n
when the output is a tty.This means that when the output is not a tty, output can be lost when Rust code doesn't flush the C streams before exiting, such as in a panic.
This explains why no error message was seen in #31 at first.
The text was updated successfully, but these errors were encountered: