Skip to content

gh-162230: Relay BufferedRWPair.readline() to the reader - #162231

Merged
cmaloney merged 5 commits into
python:mainfrom
maurycy:rwpair-readline
Nov 19, 2026
Merged

cmaloney merged 5 commits into
python:mainfrom
maurycy:rwpair-readline

Conversation

@maurycy

@maurycy maurycy commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Call the internal reader's readline() in _io and _pyio.

There is behaviour change. BufferedRWPair.readline() would behave like BufferedReader.readline(): in C, a non-blocking read with no data returns the partial line or b'' instead of raising OSError, a closed pair always raises ValueError, and subclass overrides of peek() and read() would no longer apply.

@cmaloney cmaloney left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good, I think the change in underlying calls is worth it for the performance.

Comment thread Modules/_io/bufferedio.c Resolved
@maurycy
maurycy requested a review from cmaloney November 18, 2026 22:53
@maurycy

maurycy commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

@cmaloney Thank you for taking a look! Both comments addressed.

Comment thread Modules/_io/bufferedio.c Resolved
@cmaloney

Copy link
Copy Markdown
Contributor

I created gh-162246 as a meta BufferedRWPair case. Assigned to me to try and reduce PR spam, happy for others to work on it.

@cmaloney
cmaloney merged commit 441c010 into python:main Nov 19, 2026
151 of 157 checks passed
@maurycy
maurycy deleted the rwpair-readline branch November 19, 2026 06:10
@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot ARM64 MacOS M1 Refleaks NoGIL 3.x (tier-1) has failed when building commit 441c010.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1368/builds/6097) and take a look at the build logs.
  4. Check if the failure is related to this commit (441c010) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1368/builds/6097

Failed tests:

  • test_free_threading.test_str

Summary of the results of the build (if available):

==

Click to see traceback logs
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
warning: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log
Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
warning: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log
Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

Note: switching to '441c010fef90ab2860ae8142cbfd1fd52f53ba75'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 441c010fef90 gh-162230: Relay `BufferedRWPair.readline()` to the reader (#162231)
Switched to and reset branch 'main'

configure: WARNING: pkg-config is missing. Some dependencies may not be detected correctly.

make: *** [buildbottest] Error 2

@cmaloney

Copy link
Copy Markdown
Contributor

Seems to be a failure on other things. That the traceback text from buildbot is wrong is also a thing (added to my backlog).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants