Skip to content

gh-90533: Implement BytesIO.peek()#150917

Open
marcelm wants to merge 44 commits into
python:mainfrom
marcelm:fix-issue-46375
Open

gh-90533: Implement BytesIO.peek()#150917
marcelm wants to merge 44 commits into
python:mainfrom
marcelm:fix-issue-46375

Conversation

@marcelm
Copy link
Copy Markdown

@marcelm marcelm commented Jun 4, 2026

marcelm and others added 30 commits April 10, 2026 20:37
This allows peek() to use the same optimization that read_bytes() has of
returning a reference to the buffer when possible (without copying).
Semantic change: The default argument for peek is now size=1.
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Jun 4, 2026

Documentation build overview

📚 cpython-previews | 🛠️ Build #32993754 | 📁 Comparing 3b71960 against main (a96cba5)

  🔍 Preview build  

3 files changed
± library/io.html
± whatsnew/3.16.html
± whatsnew/changelog.html

Comment thread Doc/library/io.rst Outdated
Co-authored-by: Stan Ulbrych <stan@python.org>
@cmaloney
Copy link
Copy Markdown
Contributor

cmaloney commented Jun 4, 2026

Looks like make clinic needs to be re-run and committed (lots of things can cause that)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

io.BytesIO does not have peek()

4 participants