-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[4.6] capsys: ensure fd is unbuffered #6062
Conversation
76d6927
to
46aa29e
Compare
Tests are failing, regardless, @antocuni any chance of testing this branch for your case and see if it fixes it? |
46aa29e
to
1dbd70b
Compare
1dbd70b
to
cb80252
Compare
# Ensure fd is unbuffered (#5134). | ||
self._old = os.fdopen(self._old.fileno(), "wb+", 0) | ||
except (UnsupportedOperation, OSError): | ||
pass |
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.
Note that _py36_windowsconsoleio_workaround
does something similar already:
Lines 804 to 816 in f7ecd72
def _reopen_stdio(f, mode): | |
if not buffered and mode[0] == "w": | |
buffering = 0 | |
else: | |
buffering = -1 | |
return io.TextIOWrapper( | |
open(os.dup(f.fileno()), mode, buffering), | |
f.encoding, | |
f.errors, | |
f.newlines, | |
f.line_buffering, | |
) |
I do not really feel like we should have it, since it is not required for py3 anyway, and might break other things. |
But FWIW tests are passing by now. |
I do not expect any feedback from @antocuni here (chatted with regard to the workaround he added to pyrepl). Might re-open when I look into that (pypy/pyrepl#22, pypy/pyrepl@3ff3cfa). |
Fixes #5134.