-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-138775: fix handle python -m base64 stdin correct with EOF signal
#138776
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
Conversation
Signed-off-by: yihong0618 <[email protected]>
python -m base64 stdin correct with EOF single.python -m base64 stdin correct with EOF signal.
python -m base64 stdin correct with EOF signal.python -m base64 stdin correct with EOF signal
|
I’m concerned that the current implementation reads the input in chunks, this allows the function to process the input as a stream via a pipe and avoids using too much memory with large inputs: Lines 531 to 537 in 4978bfc
With this change, however, all input is read into memory, which breaks the chunked behavior. |
Thanks for the comments I will checked if and in stdin old behavior is wrong, so I think is fine. |
Signed-off-by: yihong0618 <[email protected]>
|
keep the old behavior and use |
Misc/NEWS.d/next/Library/2025-09-11-15-03-37.gh-issue-138775.w7rnSx.rst
Outdated
Show resolved
Hide resolved
|
Thank you very much for the review again, I will try to learn how to express the change more clearly. |
Co-authored-by: Bénédikt Tran <[email protected]>
Don't worry. Considering English isn't your first language, you can just leave formulation matters to others. |
Misc/NEWS.d/next/Library/2025-09-11-15-03-37.gh-issue-138775.w7rnSx.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Peter Bierma <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Signed-off-by: yihong0618 <[email protected]>
|
I went with this PR after playing around with the BufferedReader connected to a terminal - it really is difficult to tell when you have an EOF in that scenario vs what the |
|
Thanks @yihong0618 for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
… signal (pythonGH-138776) * fix: handle stdin correct with EOF single. * fix: flollow the comments when pipe stdin use buffer * Apply suggestions from code review * fix: apply review comments in Lib/base64.py * fix: address comments * Reword comment and NEWS entry. --------- (cherry picked from commit f5c2a41) Co-authored-by: yihong <[email protected]> Signed-off-by: yihong0618 <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Gregory P. Smith <[email protected]>
|
GH-141432 is a backport of this pull request to the 3.14 branch. |
… signal (pythonGH-138776) * fix: handle stdin correct with EOF single. * fix: flollow the comments when pipe stdin use buffer * Apply suggestions from code review * fix: apply review comments in Lib/base64.py * fix: address comments * Reword comment and NEWS entry. --------- (cherry picked from commit f5c2a41) Co-authored-by: yihong <[email protected]> Signed-off-by: yihong0618 <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Gregory P. Smith <[email protected]>
|
GH-141433 is a backport of this pull request to the 3.13 branch. |
…F signal (GH-138776) (#141433) gh-138775: fix handle `python -m base64` stdin correct with EOF signal (GH-138776) * fix: handle stdin correct with EOF single. * fix: flollow the comments when pipe stdin use buffer * Apply suggestions from code review * fix: apply review comments in Lib/base64.py * fix: address comments * Reword comment and NEWS entry. --------- (cherry picked from commit f5c2a41) Signed-off-by: yihong0618 <[email protected]> Co-authored-by: yihong <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Gregory P. Smith <[email protected]>
…F signal (GH-138776) (#141432) gh-138775: fix handle `python -m base64` stdin correct with EOF signal (GH-138776) * fix: handle stdin correct with EOF single. * fix: flollow the comments when pipe stdin use buffer * Apply suggestions from code review * fix: apply review comments in Lib/base64.py * fix: address comments * Reword comment and NEWS entry. --------- (cherry picked from commit f5c2a41) Signed-off-by: yihong0618 <[email protected]> Co-authored-by: yihong <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Gregory P. Smith <[email protected]>
… signal (pythonGH-138776) * fix: handle stdin correct with EOF single. * fix: flollow the comments when pipe stdin use buffer * Apply suggestions from code review * fix: apply review comments in Lib/base64.py * fix: address comments * Reword comment and NEWS entry. --------- Signed-off-by: yihong0618 <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Gregory P. Smith <[email protected]>
This make
python -m base64the same behavior asastorjson