SIGN IN SIGN UP
python / cpython UNCLAIMED

The Python programming language

72153 0 0 Python

gh-138720: Make Buffered closed check match flush (GH-138724)

In `_io__Buffered_flush_impl` the macro `CHECK_CLOSED` is used to check
the `buffered*` is in a good state to be flushed. That differs slightly
from `buffered_closed`.

In some cases, that difference would result in `close()` thinking the
file needed to be flushed and closed while `flush()` thought the file
was already closed.

This could happen during GC and would result in an unraisable exception.
C
Cody Maloney committed
db68bfc771e6a85573732e0b579e8f68841c9b5c
Parent: 9f7bbaf
Committed by GitHub <noreply@github.com> on 9/18/2025, 10:02:29 AM