Skip to content

[3.15] gh-162246: Fix leak when re-initializing BufferedRWPair (GH-162405) - #162456

Merged
cmaloney merged 1 commit into
python:3.15from
miss-islington:backport-5257a3d-3.15
Nov 22, 2026
Merged

cmaloney merged 1 commit into
python:3.15from
miss-islington:backport-5257a3d-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Calling BufferedRWPair.__init__() on an already initialized object
overwrote the reader and writer pointers without releasing the previous
objects. Build the new reader and writer first, then swap them in,
releasing the old writer before the old reader as in
bufferedrwpair_clear().

Make the Python implementation release the old writer before the old
reader too, so pending writes are not lost when both share a raw stream.
(cherry picked from commit 5257a3d)

Co-authored-by: Cody Maloney cmaloney@users.noreply.github.com
Co-authored-by: Claude Opus 5.5 noreply@anthropic.com

…onGH-162405)

Calling `BufferedRWPair.__init__()` on an already initialized object
overwrote the reader and writer pointers without releasing the previous
objects. Build the new reader and writer first, then swap them in,
releasing the old writer before the old reader as in
`bufferedrwpair_clear()`.

Make the Python implementation release the old writer before the old
reader too, so pending writes are not lost when both share a raw stream.
(cherry picked from commit 5257a3d039c1946a09bb63b5810546ff99208a70)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@cmaloney
cmaloney merged commit 6be1526 into python:3.15 Nov 22, 2026
56 checks passed
@miss-islington
miss-islington deleted the backport-5257a3d-3.15 branch November 22, 2026 21:22
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