| Commit message (Collapse) | Author | Age |
|
|
|
| |
The `textiowrapper_iternext` function called `_textiowrapper_writeflush`, but did not
use a critical section, making it racy in free-threaded builds.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Test was only testing _io, expanded to cover _pyio.
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
|
|
| |
Adds some additional test xfails for Emscripten stack overflows. Also corrects a test skip for test_io.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
Updates test skips to reflect capabilities of Emscripten 4.0.2.
|
|
|
|
|
| |
variable at once (#131280)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
|
|
|
|
| |
(#117500)
|
| |
|
|
|
| |
Updates the Emscripten test skips to reflect recent changes in Emscripten capabilities.
|
|
|
|
|
| |
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.
|
|
|
|
| |
Marks some additional tests as skipped on Emscripten. Many of these skips can be
reverted when the next Emscripten release is available.
|
|
|
|
| |
stream cannot immediately return bytes. (GH-122933)
|
|
|
|
|
| |
value (#127219)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
| |
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
The test allocates 9 223 372 036 854 775 807 bytes
(0x7fffffffffffffff) and mimalloc fails with a division by zero on
s390x.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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-115163)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#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
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").
|
|
|
|
|
|
| |
Use the object's actual class name in the following _io type's __repr__:
- FileIO
- TextIOWrapper
- _WindowsConsoleIO
|
|
|
|
|
|
|
| |
(GH-22535)
io.TextIOWrapper was dropping the internal decoding buffer
during read() and write() calls.
|
| |
|
|
|
|
| |
recurse so deeply (GH-112150)
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
| |
Add DEFAULT_BUFFER_SIZE, text_encoding, and IncrementalNewlineDecoder.
|
|
|
|
| |
running Python (#111200)
|
|
|
|
| |
requires_resource('walltime') (GH-108480)
|
|
|
|
| |
For example, do not demand the 'cpu' resource if the test cannot be run
due to non-working threads.
|
| |
|
|
|
|
| |
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
|
|
|
|
|
| |
Adapt StringIO, TextIOWrapper, FileIO, Buffered*, and BytesIO types.
Automerge-Triggered-By: GH:erlend-aasland
|
|
|
|
| |
Co-authored-by: Oren Milman <orenmn@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
| |
Co-authored-by: Victor Stinner <vstinner@python.org>
|
|
|
|
| |
`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.
|
| |
|
|
|
| |
Co-authored-by: Brett Cannon <brett@python.org>
|