Skip to content

[3.15] gh-162246: Fix lost writes on BufferedRWPair dealloc (GH-162295) - #162351

Merged
cmaloney merged 1 commit into
python:3.15from
cmaloney:backport-dc222c8-3.15
Nov 21, 2026
Merged

cmaloney merged 1 commit into
python:3.15from
cmaloney:backport-dc222c8-3.15

Conversation

@cmaloney

@cmaloney cmaloney commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

socket.makefile("rwb") passes the same raw stream to both sides of a BufferedRWPair. When the pair is deallocated, the reader closes the stream before the writer can flush its buffer.

Release the writer first, matching the order in BufferedRWPair.close(). (cherry picked from commit dc222c8)

…ythonGH-162295)

`socket.makefile("rwb")` passes the same raw stream to both sides of a `BufferedRWPair`. When the pair is deallocated, the reader closes the stream before the writer can flush its buffer.

Release the writer first, matching the order in `BufferedRWPair.close()`.
(cherry picked from commit dc222c8)

Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
@cmaloney
cmaloney merged commit 8a05f92 into python:3.15 Nov 21, 2026
56 checks passed
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