Skip to content

gh-162246: Fix leak when re-initializing BufferedRWPair - #162405

Open
cmaloney wants to merge 1 commit into
python:mainfrom
cmaloney:gh-162246-rwpair-reinit-leak
Open

cmaloney wants to merge 1 commit into
python:mainfrom
cmaloney:gh-162246-rwpair-reinit-leak

Conversation

@cmaloney

@cmaloney cmaloney commented Nov 21, 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.

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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant