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
fileinput should use stdin.buffer for "rb" mode #65274
Comments
In Python 3, fileinput.input() returns str lines whether the data is The solution may be that, if a "b" is anywhere in the mode, then input() Otherwise the "rb" mode is rather useless since you can wind |
There is a similar, (unfixed?) bug, bpo-14156, in argparse as well. Seems like a common failing in the move to Python 3; std*.buffer was introduced, but none of the places that use it were updated, so they all became str only. |
Patch attached that checks for 'b' in self._mode and sets self._file to sys.stdin.buffer as appropriate. |
New changeset 7e640fefc9c1 by Serhiy Storchaka in branch '3.4': New changeset 4041d4077a85 by Serhiy Storchaka in branch 'default': |
Thank you Sam for your contribution. |
New changeset ded1336bff49 by R David Murray in branch '3.5': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: