Skip to content

gh-87034: Keep SpooledTemporaryFile iterators valid across rollover - #159342

Open
esadomer wants to merge 1 commit into
python:mainfrom
esadomer:fix-20261013-10-tempfile-iterator-rollover
Open

esadomer wants to merge 1 commit into
python:mainfrom
esadomer:fix-20261013-10-tempfile-iterator-rollover

Conversation

@esadomer

@esadomer esadomer commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

SpooledTemporaryFile.__iter__() exposes the underlying stream, which can become stale or closed when the file rolls over. Use the IOBase iterator so iteration follows the current stream. Cover text/binary rollover, iterator identity, position, and closed files.

Fixes #87034.

Validation (Windows debug build): test_tempfile and test_smtplib passed together (208 tests run, 6 skipped); the rollover and identity regressions failed before the fix. The isolated patch applies cleanly to the base revision.

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.

SpooledTemporaryFile.__iter__ is not transparent to rollover

1 participant