aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_io.py
Commit message (Collapse)AuthorAge
* gh-134908: Protect `textiowrapper_iternext` with critical section (gh-134910)Duane Griffin5 days
| | | | The `textiowrapper_iternext` function called `_textiowrapper_writeflush`, but did not use a critical section, making it racy in free-threaded builds.
* gh-71339: Use new assertion methods in tests (GH-129046)Serhiy Storchaka2025-05-22
|
* gh-133982: Run unclosed file test on all io implementations (gh-134165)Cody Maloney2025-05-21
| | | | | | | | | | | Update `test_io` `_check_warn_on_dealloc` to use `self.` to dispatch to different I/O implementations. Update the `_pyio` implementation to match expected behavior, using the same `_dealloc_warn` design as the C implementation uses to report the topmost `__del__` object. The FileIO one now matches all the others, so can use IOBase. There was a missing check on closing (self._fd must be valid), add that check
* gh-71253: Match _io exception in _pyio (gh-133985)Cody Maloney2025-05-21
| | | | | | Test was only testing _io, expanded to cover _pyio. Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* gh-127146: xfail more Emscripten stack overflows (#134358)Hood Chatham2025-05-20
| | | Adds some additional test xfails for Emscripten stack overflows. Also corrects a test skip for test_io.
* gh-122559: Synchronize C and Python implementation of the io module about ↵Serhiy Storchaka2025-05-04
| | | | | | | | | | | pickling (GH-122628) In the C implementation, remove __reduce__ and __reduce_ex__ methods that always raise TypeError and restore __getstate__ methods that always raise TypeErrori. This restores fine details of the pre-3.12 behavior and unifies both implementations.
* gh-132952: Speed up startup by importing _io instead of io (#132957)Jelle Zijlstra2025-04-28
|
* gh-127146: Update test skips for Emscripten 4.0.2 (#129474)Hood Chatham2025-03-17
| | | Updates test skips to reflect capabilities of Emscripten 4.0.2.
* gh-131277: allow `EnvironmentVarGuard` to unset more than one environment ↵Bénédikt Tran2025-03-16
| | | | | variable at once (#131280) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* gh-117174: Add a new route in linecache to fetch interactive source code ↵Pablo Galindo Salgado2025-03-10
| | | | (#117500)
* gh-127647: Add typing.Reader and Writer protocols (#127648)Sebastian Rittau2025-03-06
|
* gh-127146: Update test skips for Emscripten 4.0.1 (#129375)Hood Chatham2025-01-28
| | | Updates the Emscripten test skips to reflect recent changes in Emscripten capabilities.
* gh-128438: Use `EnvironmentVarGuard` for `test_{builtin,io,locale}.py` (#128476)Yan Yanchii2025-01-15
| | | | | Modifying locale-related environment variables in `Lib/test/test_builtin.py`, `Lib/test/test_io.py` and `Lib/test/test_locale.py` is now achieved by using an `EnvironmentVarGuard` context instead of an explicit `try-finally` block.
* gh-127146: Skip Emscripten tests with pending fixes (#128549)Hood Chatham2025-01-07
| | | | Marks some additional tests as skipped on Emscripten. Many of these skips can be reverted when the next Emscripten release is available.
* gh-109523: Raise a BlockingIOError if reading text from a non-blocking ↵Giovanni Siragusa2024-12-02
| | | | stream cannot immediately return bytes. (GH-122933)
* gh-127182: Fix `io.StringIO.__setstate__` crash when `None` is the first ↵sobolevn2024-11-25
| | | | | value (#127219) Co-authored-by: Victor Stinner <vstinner@python.org>
* Bump Ruff to 0.6.7 (#124384)Alex Waygood2024-09-23
|
* gh-119506: fix `_io.TextIOWrapper.write()` write during flush (#119507)Radislav Chugunov2024-06-03
| | | Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* gh-117755: Remove tests on huge memory allocations (#117938)Victor Stinner2024-04-16
| | | | | | | | | | | | | | | | | | | Remove unreliable tests on huge memory allocations: * Remove test_maxcontext_exact_arith() of test_decimal. Stefan Krah, test author, agreed on removing the test: https://github.com/python/cpython/issues/114331#issuecomment-1925731273 * Remove test_constructor() tests of test_io. Sam Gross suggests remove them: https://github.com/python/cpython/pull/117809#pullrequestreview-2003889558 On Linux, depending how overcommit is configured, especially on Linux s390x, a huge memory allocation (half or more of the full address space) can succeed, but then the process will eat the full system swap and make the system slower and slower until the whole system becomes unusable. Moreover, these tests had to be skipped when Python is built with sanitizers.
* gh-117755: Skip test_io.test_constructor() on s390x (#117801)Victor Stinner2024-04-15
| | | | | The test allocates 9 223 372 036 854 775 807 bytes (0x7fffffffffffffff) and mimalloc fails with a division by zero on s390x.
* gh-115775: Compiler adds __static_attributes__ field to classes (#115913)Irit Katriel2024-03-26
|
* gh-95782: Fix io.BufferedReader.tell() etc. being able to return offsets < 0 ↵6t8k2024-02-17
| | | | | | | | | | | | | | | | | | | | (GH-99709) lseek() always returns 0 for character pseudo-devices like `/dev/urandom` (for other non-regular files, e.g. `/dev/stdin`, it always returns -1, to which CPython reacts by raising appropriate exceptions). They are thus technically seekable despite not having seek semantics. When calling read() on e.g. an instance of `io.BufferedReader` that wraps such a file, `BufferedReader` reads ahead, filling its buffer, creating a discrepancy between the number of bytes read and the internal `tell()` always returning 0, which previously resulted in e.g. `BufferedReader.tell()` or `BufferedReader.seek()` being able to return positions < 0 even though these are supposed to be always >= 0. Invariably keep the return value non-negative by returning max(former_return_value, 0) instead, and add some corresponding tests.
* gh-115059: Remove debugging code in test_io (GH-115240)Serhiy Storchaka2024-02-10
|
* gh-115059: Flush the underlying write buffer in io.BufferedRandom.read1() ↵Serhiy Storchaka2024-02-09
| | | | (GH-115163)
* gh-114099: Add test exclusions to support running the test suite on iOS ↵Russell Keith-Magee2024-02-05
| | | | | | | | | | | | | (#114889) Add test annotations required to run the test suite on iOS (PEP 730). The majority of the change involve annotating tests that use subprocess, but are skipped on Emscripten/WASI for other reasons, and including iOS/tvOS/watchOS under the same umbrella as macOS/darwin checks. `is_apple` and `is_apple_mobile` test helpers have been added to identify *any* Apple platform, and "any Apple platform except macOS", respectively.
* gh-112529: Implement GC for free-threaded builds (#114262)Sam Gross2024-01-25
| | | | | | | * gh-112529: Implement GC for free-threaded builds This implements a mark and sweep GC for the free-threaded builds of CPython. The implementation relies on mimalloc to find GC tracked objects (i.e., "containers").
* gh-66060: Use actual class name in _io type's __repr__ (#30824)AN Long2024-01-09
| | | | | | Use the object's actual class name in the following _io type's __repr__: - FileIO - TextIOWrapper - _WindowsConsoleIO
* gh-80109: Fix io.TextIOWrapper dropping the internal buffer during write() ↵Zackery Spytz2024-01-08
| | | | | | | (GH-22535) io.TextIOWrapper was dropping the internal decoding buffer during read() and write() calls.
* gh-112536: Add support for thread sanitizer (TSAN) (gh-112648)Samet YASLAN2023-12-30
|
* gh-111800: Fix `test_recursive_repr` from `test_io` under WASI to not ↵Nikita Sobolev2023-11-16
| | | | recurse so deeply (GH-112150)
* gh-111942: Fix SystemError in the TextIOWrapper constructor (#112061)Serhiy Storchaka2023-11-14
| | | | | | In non-debug more the check for the "errors" argument is skipped, and then PyUnicode_AsUTF8() can fail, but its result was not checked. Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-111942: Fix crashes in TextIOWrapper.reconfigure() (GH-111976)Serhiy Storchaka2023-11-14
| | | | | | | | * Fix crash when encoding is not string or None. * Fix crash when both line_buffering and write_through raise exception when converted ti int. * Add a number of tests for constructor and reconfigure() method with invalid arguments.
* gh-111356: io: Add missing documented objects to io.__all__ (#111370)Nicolas Tessore2023-11-10
| | | Add DEFAULT_BUFFER_SIZE, text_encoding, and IncrementalNewlineDecoder.
* gh-67224: Show source lines in tracebacks when using the -c option when ↵Pablo Galindo Salgado2023-10-26
| | | | running Python (#111200)
* gh-108416: Mark slow but not CPU bound test methods with ↵Serhiy Storchaka2023-09-05
| | | | requires_resource('walltime') (GH-108480)
* Reorder some test's decorators (GH-108804)Serhiy Storchaka2023-09-03
| | | | For example, do not demand the 'cpu' resource if the test cannot be run due to non-working threads.
* gh-62948: IOBase finalizer logs close() errors (#105104)Victor Stinner2023-05-31
|
* gh-101819: Isolate `_io` (#101948)Erlend E. Aasland2023-05-15
| | | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-101819: Adapt _io types to heap types, batch 1 (GH-101949)Erlend E. Aasland2023-02-20
| | | | | Adapt StringIO, TextIOWrapper, FileIO, Buffered*, and BytesIO types. Automerge-Triggered-By: GH:erlend-aasland
* bpo-31718: Fix io.IncrementalNewlineDecoder SystemErrors and segfaults (#18640)Zackery Spytz2022-11-28
| | | | Co-authored-by: Oren Milman <orenmn@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-38031: Fix a possible assertion failure in _io.FileIO() (#GH-5688)Zackery Spytz2022-11-25
|
* gh-98999: Raise `ValueError` in `_pyio` on closed buffers (gh-99009)Nikita Sobolev2022-11-03
|
* gh-94169: Remove deprecated io.OpenWrapper (#94170)Victor Stinner2022-06-24
| | | | | | Remove io.OpenWrapper and _pyio.OpenWrapper, deprecated in Python 3.10: just use :func:`open` instead. The open() (io.open()) function is a built-in function. Since Python 3.10, _pyio.open() is also a static method.
* gh-69443: Add test.support.Py_DEBUG constant (#93226)Victor Stinner2022-05-26
|
* gh-93099: Fix _pyio to use locale module properly (gh-93136)Dong-hee Na2022-05-24
|
* gh-90473: WASI: Mark tests that require os.pipe() (GH-92837)Christian Heimes2022-05-16
|
* gh-91156: Use `locale.getencoding()` instead of getpreferredencoding (GH-91732)Inada Naoki2022-04-22
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-91526: io: Remove device encoding support from TextIOWrapper (GH-91529)Inada Naoki2022-04-19
| | | | `TextIOWrapper.__init__()` called `os.device_encoding(file.fileno())` if fileno is 0-2 and encoding=None. But it is very rarely works, and never documented behavior.
* gh-91156: Fix `encoding="locale"` in UTF-8 mode (GH-70056)Inada Naoki2022-04-14
|
* bpo-40280: Detect missing threading on WASM platforms (GH-32352)Christian Heimes2022-04-07
| | | Co-authored-by: Brett Cannon <brett@python.org>