cpython/Lib/test/test_io
Cody Maloney db4b1948bc
gh-143008: Fix Null pointer dereferences in TextIOWrapper underlying stream access (#145957)
TextIOWrapper keeps its underlying stream in a member called
`self->buffer`. That stream can be detached by user code, such as custom
`.flush` implementations resulting in `self->buffer` being set to NULL.
The implementation often checked at the start of functions if
`self->buffer` is in a good state, but did not always recheck after
other Python code was called which could modify `self->buffer`.

The cases which need to be re-checked are hard to spot so rather than
rely on reviewer effort create better safety by making all self->buffer
access go through helper functions.

Thank you yihong0618 for the test, NEWS and initial implementation in
gh-143041.

Co-authored-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-09 12:31:44 +02:00
..
__init__.py gh-138013: Move I/O tests to test_io (#138365) 2025-09-03 11:37:06 +02:00
__main__.py
test_bufferedio.py gh-143689: Fix BufferedReader.read1 leaving object in reentrant state on error (#143690) 2026-01-19 15:09:30 +01:00
test_file.py gh-138013: Move I/O tests to test_io (#138365) 2025-09-03 11:37:06 +02:00
test_fileio.py gh-69528: Distinguish between file modes "wb+" and "rb+" (GH-137834) 2025-10-21 20:33:30 +03:00
test_general.py gh-60107: Remove a copy from RawIOBase.read (#141532) 2025-11-20 17:37:04 +00:00
test_largefile.py gh-129005: Remove copies from _pyio using take_bytes (#141539) 2025-11-18 10:10:32 +01:00
test_memoryio.py gh-149046: fix: correctly handle str subclasses in io.StringIO (#149047) 2026-06-01 13:01:57 +00:00
test_signals.py gh-138013: Split SignalsTest from test_io.test_general (#139079) 2025-09-19 18:21:50 +00:00
test_textio.py gh-143008: Fix Null pointer dereferences in TextIOWrapper underlying stream access (#145957) 2026-06-09 12:31:44 +02:00
test_univnewlines.py gh-138013: Move I/O tests to test_io (#138365) 2025-09-03 11:37:06 +02:00
utils.py gh-138013: Move I/O test infrastructre to test_io.utils (#138475) 2025-09-11 12:45:30 +02:00