#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.
diff --git a/Lib/fileinput.py b/Lib/fileinput.py
index c41b94a..021e39f 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -328,7 +328,7 @@
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