diff options
author | R David Murray <rdmurray@bitdance.com> | 2016-01-02 15:41:41 -0500 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2016-01-02 15:41:41 -0500 |
commit | 830207e8f32df949ec35e2e7f5afe98975e262c9 (patch) | |
tree | faddddb33d51837ca7de7bfecb0f809d535f0255 /Lib/fileinput.py | |
parent | fcb6db50d3cce6337f28c9c1b891905cc323ad13 (diff) | |
download | cpython-git-830207e8f32df949ec35e2e7f5afe98975e262c9.tar.gz |
#22709: Use stdin as-is if it does not have a buffer attribute.
This restores backward compatibility lost in the fix for #21075, and
is better duck typing.
Patch by Akira Li.
Diffstat (limited to 'Lib/fileinput.py')
-rw-r--r-- | Lib/fileinput.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py index c41b94abff..021e39f83a 100644 --- a/Lib/fileinput.py +++ b/Lib/fileinput.py @@ -328,7 +328,7 @@ class FileInput: if self._filename == '-': self._filename = '<stdin>' if 'b' in self._mode: - self._file = sys.stdin.buffer + self._file = getattr(sys.stdin, 'buffer', sys.stdin) else: self._file = sys.stdin self._isstdin = True |