Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Lib/base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,14 @@ def main():
with open(args[0], 'rb') as f:
func(f, sys.stdout.buffer)
else:
func(sys.stdin.buffer, sys.stdout.buffer)
if sys.stdin.isatty():
# gh-138775: read terminal input data all at once to detect EOF
import io
data = sys.stdin.buffer.read()
buffer = io.BytesIO(data)
else:
buffer = sys.stdin.buffer
func(buffer, sys.stdout.buffer)


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Use of ``python -m`` with :mod:`base64` has been fixed to detect input from a
terminal so that it properly notices EOF.
Loading