Skip to content

gh-111330: Fix GC of _pyio.BytesIO with exports#152335

Open
cmaloney wants to merge 2 commits into
python:mainfrom
cmaloney:pyio_bytesio_close
Open

gh-111330: Fix GC of _pyio.BytesIO with exports#152335
cmaloney wants to merge 2 commits into
python:mainfrom
cmaloney:pyio_bytesio_close

Conversation

@cmaloney

@cmaloney cmaloney commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Swap out the buffer rather than using .clear() which will raise an exception if there are exports. Rely on bytearray (self._buffer) being the exported object to make sure it doesn't get garbage collected.

Swap out the buffer rather than using `.clear()` which will raise an
exception if there are epxorts.
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.

1 participant