FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-159739: Respect readline limits after a short read by jelle-openai · Pull Request #159974 · python/cpython · GitHub

Repository navigation

gh-159739: Respect readline limits after a short read - #159974

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-readline-limit
Oct 22, 2026
Merged

JelleZijlstra merged 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-readline-limit

Conversation

jelle-openai commented Oct 20, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor

When a binary IOBase subclass provides peek() and read() returns fewer bytes than requested, readline(size) calculates subsequent reads against the original limit instead of the number of bytes still allowed. It can consume and return more than size bytes, leaving less data for the next read. Apply the remaining limit in both the C and pure-Python implementations.

Backport to 3.15 and 3.14. Both branches use a bytearray instead of PyBytesWriter; the test lives in Lib/test/test_io.py on 3.14.

Backport to 3.15 and 3.14. Both branches use a bytearray instead of PyBytesWriter; the test lives in Lib/test/test_io.py on 3.14.
JelleZijlstra added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 20, 2026
JelleZijlstra merged commit 87eaef1 into python:main Oct 22, 2026
62 checks passed

Copy link
Copy Markdown

Thanks @jelle-openai for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

Copy link
Copy Markdown

Sorry, @jelle-openai and @JelleZijlstra, I could not cleanly backport this to 3.14 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker 87eaef117191037cebce2becea5350ff4f45dee3 3.14

bedevere-app Bot commented Oct 22, 2026

Copy link
Copy Markdown

GH-160246 is a backport of this pull request to the 3.15 branch.

bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 22, 2026
JelleZijlstra pushed a commit that referenced this pull request Oct 22, 2026
…) (#160246)

Backport to 3.15 and 3.14. Both branches use a bytearray instead of PyBytesWriter; the test lives in Lib/test/test_io.py on 3.14.
(cherry picked from commit 87eaef1)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>

bedevere-app Bot commented Oct 23, 2026

Copy link
Copy Markdown

GH-160483 is a backport of this pull request to the 3.14 branch.

bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL