Commit Graph

53 Commits

Author SHA1 Message Date
Jiseok CHOI
be39a67f27 Handle reentrant detach in TextIOWrapper.close() (#7277)
When a custom `closed` property on the underlying buffer calls
`detach()` during the `file_closed()` check in `close()`, the
wrapper's internal buffer becomes None. Subsequent flush/close
operations then fail with AttributeError on NoneType.

Add a guard after the `file_closed()` check to detect if the buffer
was detached reentrantly, and return early in that case (detach has
already flushed the stream).

This mirrors the fix applied in CPython
(https://github.com/python/cpython/issues/142594\).
2026-03-01 10:44:13 +09:00
Jeong, YunWon
6950baf687 more algorithm-independent GC infra (#7194)
* mark poluting tests

* GC-infra independent to EBR

* trashcan

* add overflow guard to inc(), #[must_use] on dec()/safe_inc(), trashcan debug_assert, weakref generic re-check
2026-02-22 21:31:42 +09:00
CPython Developers
9924e2978a Update io from v3.14.3 2026-02-13 14:13:30 +09:00
Jeong, YunWon
258ac74384 fix io 2026-02-06 00:15:18 +09:00
CPython Developers
e948314a3e Update test_io from v3.14.3 2026-02-06 00:15:18 +09:00
Jeong, YunWon
afea16569b Fix test_io expectedFailures 2026-02-06 00:15:18 +09:00
Jeong, YunWon
100b870175 Implement UTF-32 encode/decode and fix UTF-16 empty encode
- Add UTF-32, UTF-32-LE, UTF-32-BE encode/decode in _pycodecs.py
- Register utf_32 codec functions in codecs.rs via delegate_pycodecs
- Fix PyUnicode_EncodeUTF16 returning "" instead of [] for empty input
- Remove resolved expectedFailure decorators in test_codecs.py
- Add failure reasons to remaining expectedFailure comments
2026-02-02 12:50:34 +09:00
Jeong, YunWon
7004502951 dealloc and finalize_modules (#6934)
* rewrite finalize_modules with phased algorithm

Replace the absence of module finalization during interpreter shutdown
with a 5-phase algorithm matching pylifecycle.c finalize_modules():

1. Set special sys attributes to None, restore stdio
2. Set all sys.modules values to None, collect module dicts
3. Clear sys.modules dict
4. Clear module dicts in reverse import order (2-pass _PyModule_ClearDict)
5. Clear sys and builtins dicts last

This ensures __del__ methods are called during shutdown and modules are
cleaned up in reverse import order without hardcoded module names.

* dealloc the rigth way

* fix finalize_modules: only clear __main__ dict, mark daemon thread tests as expected failure

Without GC, clearing all module dicts during finalization causes __del__
handlers to fail (globals are None). Restrict Phase 4 to only clear
__main__ dict — other modules' globals stay intact for their __del__
handlers.

Mark test_daemon_threads_shutdown_{stdout,stderr}_deadlock as expected
failures — without GC+GIL, finalize_modules clears __main__ globals
while daemon threads are still running.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 10:10:58 +09:00
Terry Tianlin Luan
609dbb1439 Downgraded skips in tests (#6716)
* Downgraded skips in tests

* Fixed failing tests

* Fixed test_ftplib + test_socket + test_ssl + test_threaded_import failures

* Removed comments about which tests are run in which environment

* Addressed PR comments

* Annotated skips on failing tests

* Removed unneeded tests

* Removed unneeded sys import from test_ftplib

* Added annotation to test_ftplib

* Readded skipIf to test_cleanup_with_symlink_modes with a more general ENV_POLLUTING_TESTS_WINDOWS

* Addressed PR comments

* Made changes to minimize diff in PR

* Apply suggestion from @youknowone

---------

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2026-01-15 21:43:22 +09:00
Padraic Fanning
cadac344a7 Unmark passing tests in test_io 2026-01-10 22:10:35 -05:00
Padraic Fanning
c76e72571e Skip panicking tests in test_io 2026-01-10 22:10:35 -05:00
Jeong, YunWon
476b75de49 Upgrade test_io from 3.13.11 and fix more io tests (#6565)
* fix various test_io

* Upgrade test_io from 3.13.11

* Fix more test_io
2025-12-28 20:36:15 +09:00
Jeong, YunWon
3600b6652d update _pyio, test_fileio from 3.13.11 and impl more io features (#6560)
* Update _pyio, test_fileio from 3.13.11

* impl more io

* unmark sucessful tests

* fix windows fileio
2025-12-28 18:06:47 +09:00
Jeong, YunWon
30fb9d73cc Fix test_io on windows (#6387)
* mark skip on test_io

* Drop for FileIO

* IO Desctructors

* Iterator
2025-12-10 09:21:32 +09:00
Jeong, YunWon
ac48643447 Add TextIOWrapper.truncate, fix a few bugs (#6382) 2025-12-10 00:58:21 +09:00
fanninpm
59f422de66 Add _io.TextIOWrapper.detach method (#6267)
* Stub out _io.TextIOWrapper.detach method

* Implement _io.TextIOWrapper.detach method

* Make _io.TextIOWrapper.detach not re-enter lock
2025-12-03 16:11:39 +09:00
Shahar Naveh
67958ec791 Update {io,encodings} from 3.13.7 (#6153)
* Update `io` from 3.13.7

* Patch test & upsate `encodings` from 3.13.7

* Unmark passing tests
2025-09-16 21:53:25 +09:00
Lee Dogeon
5953a938bd chore: test testcases with @unittest.skip decorator (#5871)
Signed-off-by: Lee Dogeon <dev.moreal@gmail.com>
2025-06-30 19:07:58 +09:00
Noa
fbd0c7a99e Implement IncrementalNewlineDecoder in rust 2024-11-14 23:06:53 -06:00
Jeong YunWon
9944b3dac1 Mark failing tests 2024-07-28 20:24:15 +09:00
CPython Developers
0600ae6213 Update io, pyio, test_io from CPython 2024-07-28 20:24:15 +09:00
Jeong YunWon
623415d843 IncrementalNewlineDecoder from pyio 2024-07-28 20:23:53 +09:00
Dean Li
7496845381 test: update test_io.py to 3.10 2022-06-29 18:02:57 +08:00
Dean Li
121b35d27c io: enhance error message in Buffered* class 2022-05-19 23:15:42 +08:00
Padraic Fanning
3b22405ea8 Unmark passing tests 2022-04-27 18:58:17 -04:00
Jeong Yunwon
ca84d728c2 sys.unraisablehook 2022-04-23 08:06:17 +09:00
Dean Li
29c953d9a6 test: update test.support and test_io to 3.10
Initially this is only meant to be a small update for `test_io.py`.
But it turns out that `test.support` need a lot of cleanup especially
for `test.support.warnings_helper`.
2022-04-18 22:50:55 +08:00
Padraic Fanning
c8748bc98e Fix test.support imports 2022-02-13 17:56:08 -05:00
Dean Li
6f98288e84 test: use import_helper 2021-11-29 21:03:02 +08:00
Dean Li
5ee4fb899b test: use os_helper 2021-11-28 20:51:32 +08:00
Jeong YunWon
913b78ca44 Revert "Merge pull request #3433 from deantvv/test-update"
This reverts commit 9fa5c5ac66, reversing
changes made to e7fa32c687.
2021-11-17 17:06:51 +09:00
Dean Li
49a5805d11 test: use os_helper 2021-11-13 02:18:33 +00:00
Daniel Watkins
1ea93a59d5 stdlib/io.rs: align negative-fd-from-opener exception with CPython 2021-10-28 15:05:55 -04:00
Padraic Fanning
4e21df2c3b Clean up skips in test_io 2021-10-15 00:09:49 +09:00
Jeong YunWon
f2ecab46ef unmark successful tests 2021-09-14 02:22:41 +09:00
Frank King
e652ae8fc0 Support unicode array type. 2021-08-21 20:18:05 +08:00
Noah
ab658a11a6 Call the encoder for TextIOWrapper.write 2021-05-13 19:46:17 -05:00
Noah
80e5c984f4 Implement TextIOWrapper.readline correctly 2021-05-13 19:46:17 -05:00
Noah
4250a5dbaa Properly implement TextIOWrapper using codecs 2021-05-13 19:46:17 -05:00
Kangzhi Shi
8522d120e5 fix array from bytes 2021-04-16 09:17:13 +02:00
Padraic Fanning
4ba5829fe1 Delete code smell 2021-02-27 19:37:01 -05:00
Padraic Fanning
884c189bf6 Unskip tests in test_io 2021-02-25 21:28:54 -05:00
Padraic Fanning
acf8d6af99 Reconfigure SignalsTest skip(s) 2021-02-07 15:49:42 -05:00
Padraic Fanning
3b261f4511 Pass test_daemon_threads_shutdown_stderr_deadlock 2021-02-07 15:49:42 -05:00
Padraic Fanning
641c7d3833 Pass test_daemon_threads_shutdown_stdout_deadlock 2021-02-07 15:49:42 -05:00
Padraic Fanning
d32f467f39 Explain test_nonblock_pipe_write_smallbuf skip 2021-02-07 15:49:42 -05:00
Padraic Fanning
cf3e613871 Explain test_nonblock_pipe_write_bigbuf skip 2021-02-07 15:49:42 -05:00
Padraic Fanning
c1673b85c3 Explain test_override_destructor skip 2021-02-07 15:49:42 -05:00
Padraic Fanning
6eda036ee2 Reconfigure TextIOWrapperTest skip(s)
This also regresses two tests in the CTextIOWrapperTest class.
2021-02-07 15:49:42 -05:00
Jeong YunWon
308f831810 unksip test_io.py 2020-11-12 11:30:33 +09:00