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

[4.6] capsys: ensure fd is unbuffered #6062

Closed

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Oct 26, 2019

Fixes #5134.

@nicoddemus
Copy link
Member

Tests are failing, regardless, @antocuni any chance of testing this branch for your case and see if it fixes it?

# Ensure fd is unbuffered (#5134).
self._old = os.fdopen(self._old.fileno(), "wb+", 0)
except (UnsupportedOperation, OSError):
pass
Copy link
Contributor Author

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:

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,
)

@blueyed
Copy link
Contributor Author

blueyed commented Oct 28, 2019

I do not really feel like we should have it, since it is not required for py3 anyway, and might break other things.

@blueyed
Copy link
Contributor Author

blueyed commented Oct 28, 2019

But FWIW tests are passing by now.

@blueyed
Copy link
Contributor Author

blueyed commented Nov 1, 2019

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).

@blueyed blueyed closed this Nov 1, 2019
@blueyed blueyed deleted the fix-capsys-py2-4.6 branch November 1, 2019 17:35
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.

2 participants