mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
#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.
This commit is contained in:
parent
fcb6db50d3
commit
830207e8f3
3 changed files with 15 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue