Skip to content

[pull] main from python:main - #1530

Merged
pull[bot] merged 3 commits into
tj-python:mainfrom
python:main
Sep 28, 2026
Merged

pull[bot] merged 3 commits into
tj-python:mainfrom
python:main

Conversation

@pull

@pull pull Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

StanFromIreland and others added 3 commits September 28, 2026 09:00
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
…158214)

Since GH-157861, every writer uses the read-only optimization of
_PyUnicodeWriter_WriteStr(), so the first write of a str subclass
instance into an empty writer kept that object as the buffer, and
PyUnicodeWriter_Finish() returned it.  io.StringIO.getvalue() then
returned the written object itself, and the next write re-read it
through its __str__() method, which changed the contents and could make
read() read past the end of the buffer.

Only use the read-only optimization for exact str objects.  A subclass
is copied into a new buffer, as before GH-157861.
@pull pull Bot locked and limited conversation to collaborators Sep 28, 2026
@pull pull Bot added the ⤵️ pull label Sep 28, 2026
@pull
pull Bot merged commit 7352b6a into tj-python:main Sep 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants