GC of unclosed io.BuffererdRWPair after .readinto results in unraisable exception #138720
Copy link
Copy link
Closed
Closed
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Sep 9, 2025 - added a commit that references this issue
on Sep 10, 2025 - addedextension-modulesC modules in the Modules dirC modules in the Modules dir
on Sep 10, 2025
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Bug report
Bug description:
In
BufferedRWPairTest.test_readintoaBufferedRWPairis created but not explicitly closed which results in it being Garbage Collected (GC). During GC the destruction order often results in an unraisable exception. This can be reliably reproduced by modifying the test to end withsupport.gc_collect(). The BufferedRWPair should cleanup reliably in this case.cpython/Lib/test/test_io/test_general.py
Lines 2281 to 2288 in 6bc65c3
Found while working on GH-138475
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs