39 Commits

Author SHA1 Message Date
Jeong, YunWon
2d676e7f4d A few windows fix (#7458)
* Disallow instantiation of sys.getwindowsversion type

Add slot_new to PyWindowsVersion that raises TypeError,
matching sys.flags behavior.

* Remove incorrect WSAHOS errno constant

WSAHOS was hardcoded as an alias for WSAHOST_NOT_FOUND, but
CPython guards it with #ifdef WSAHOS which doesn't exist in
modern Windows SDK headers.

* Fix mmap resize to raise OSError instead of SystemError

* Fix CreateProcess with empty environment on Windows

Empty env dict produced a single null terminator, but
CreateProcessW requires a double null for a valid empty
environment block.

* Revert mmap resize error to SystemError and fix errno.rs formatting

mmap resize raises SystemError (not OSError) when mremap is unavailable,
matching CPython behavior. test_mmap catches SystemError to skip unsupported
resize operations.

* Fix named mmap resize to raise OSError and unmark test_sleep expectedFailure

Named mmap resize on Windows should raise OSError (not SystemError).
Remove expectedFailure mark from TimeEINTRTest.test_sleep as it now passes.

* Use expectedFailureIf for TimeEINTRTest.test_sleep on Linux

test_sleep passes on macOS but fails on Linux due to timing.

* Remove expectedFailure for TimeEINTRTest.test_sleep

test_sleep now passes on all platforms.
2026-03-21 22:49:09 +09:00
Jeong, YunWon
d19d523c8d Move sys.flags thread_inherit_context/context_aware_warnings to getset 2026-02-21 22:58:12 +09:00
Jeong, YunWon
ea8e25cee5 Register latin-1 codec and fix stdio bootstrap 2026-02-21 22:58:12 +09:00
Jeong, YunWon
6a02392b57 Fix WindowsVersionData n_sequence_fields 2026-02-21 22:58:12 +09:00
Jeong, YunWon
add253912e Implement sys.call_tracing, sys._current_exceptions
- Add sys.call_tracing as func(*args) dispatch
- Add sys._current_exceptions with per-thread exception tracking
  via thread_exceptions registry synced on push/pop/set_exception
- Fix f_back to use previous_frame pointer and cross-thread lookup
- Add module="sys" to float_info struct sequence
- Fix sys.exit to unpack tuple args
- Set default stdio_errors to surrogateescape
- Remove noisy __del__ warning in object core
2026-02-21 14:12:18 +09:00
CPython Developers
edca2dddf1 Update test_sys from v3.14.3 2026-02-21 14:12:18 +09:00
Jeong, YunWon
b5785e2777 Use _print_exception_bltin in excepthook, register source in linecache (#7177)
- excepthook: call traceback._print_exception_bltin instead of
  traceback.print_exception to match PyErr_Display behavior
- run_string: register compiled code in linecache._interactive_cache
  so traceback can display source lines and caret indicators
- Remove test_sys_tracebacklimit expectedFailure
2026-02-18 01:50:27 +09:00
Jeong, YunWon
6b870d62ad Fix traceback, syntax errors, and exception handling (#7015)
* Update codeop from v3.14.3

* Fix traceback, syntax errors, and exception handling

- Improve unclosed bracket detection with "'(' was never closed" message
- Fix IndentationError location to point to end of line
- Implement frame.clear() with proper checks for executing/suspended frames
- Fix exception context chaining for propagated exceptions
- Add traceback.__dir__() and prevent tb_next deletion
- Fix subscript operation source range restoration in compiler
- Change "duplicate parameter" to "duplicate argument" error message
- Refactor duplicate code in asyncgenerator.rs and frame.rs

---------

Co-authored-by: CPython Developers <>
2026-02-07 13:41:45 +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
Jeong, YunWon
b76906a8bf Add sys._stdlib_dir (#6798) 2026-01-20 03:38:40 +09:00
Jeong, YunWon
3a9f020234 update test_sys from 3.14.2 (#6781)
* sys.is_remote_debug_enabled, supports_isolated_interpreters

* Update test_sys form Python 3.14.2

---------

Co-authored-by: CPython Devleopers <>
2026-01-18 23:58:39 +09:00
fanninpm
e4ce70bbda Update Lib/warnings to CPython 3.14 (#6762)
* Update Lib/warnings to CPython 3.14

* Add context_aware_warnings setting

XXX- The default setting of this and thread_inherit_context should be
true.

* Unmark passing test

* Mark failing tests

* Skip failing test in test_sys for now

Updating test_sys to CPython 3.14 is beyond the scope of this PR.

* test_improper_option is fixed

---------

Co-authored-by: Jeong, YunWon <jeong@youknowone.org>
2026-01-18 13:59:49 +09:00
Jeong, YunWon
ca76cb7bb0 thread_inherit_context, upgrade threading & contextvar (#6727)
* thread_inherit_context

* Update contextvar, threading from CPython 3.14.2

* partially patch test_sys to 3.14.2

---------

Co-authored-by: CPython Devleopers <>
2026-01-18 08:53:41 +09:00
Jeong, YunWon
69601a18a4 Upgrade threading to 3.13.11; sys.setprofile & impl more threading (#6691)
* Upgrade threading,test_threading from 3.13.11

* increase ci limit to 45mins

* impl more threading

* no static for asyncgen
2026-01-12 15:33:28 +09:00
Shahar Naveh
3e2ada0586 Update test_sys.py from 3.13.11 (#6428)
* mark RustPython as  free-threaded

* Py_GIL_DISABLED

* Update `test_sys.py` from 3.13.11

* mark tests

---------

Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2026-01-01 18:35:55 +09:00
Jeong, YunWon
feb5066be2 stdlib_module_names (#6568) 2025-12-29 21:43:40 +09:00
Jeong, YunWon
9c2a4695c1 Fix excepthook (#5830) 2025-06-24 16:58:27 +09:00
Jeong, YunWon
5d68313f91 sys.setswitchinterval (#5817) 2025-06-22 22:36:13 +09:00
Jeong YunWon
6f8360a878 sys.exception 2024-07-29 14:30:59 +09:00
Jeong YunWon
bc87fadc03 mark new failing tests 2023-02-25 23:00:51 +09:00
CPython Developers
ad7544ce90 Update test_sys from CPython 3.11.2 2023-02-25 23:00:51 +09:00
Jeong YunWon
e45b5b35e3 Update test_sys from CPython 3.10.5 2023-02-25 23:00:50 +09:00
Karatus
c334626f3c Feature: sys.orig_argv (#4048) 2022-08-20 22:58:58 +09:00
Hyunmin Shin
53f3fe3dca Remove: test_thread_info expectedFailure 2022-08-12 00:30:15 +09:00
Jeong Yunwon
e62fdd105c fix windows CI 2022-07-26 04:03:00 +09:00
Jeong Yunwon
e32523c632 turn a few more windows tests on 2022-07-25 04:10:59 +09:00
Isac Byeonghoon Yoo
ce546f6183 feat(sys): add sys.is_finalizing() (#3776) 2022-06-11 21:10:09 +09:00
Padraic Fanning
b70eb8989a Mark erroring tests 2022-04-27 19:11:02 -04:00
Padraic Fanning
1d2573173d Update test_sys.py to CPython 3.10 2022-04-27 18:58:17 -04:00
Padraic Fanning
c8748bc98e Fix test.support imports 2022-02-13 17:56:08 -05: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
Padraic Fanning
24dd039b47 Clean up skips in test_sys 2021-10-18 19:18:59 -04:00
Noah
c88d935ca0 Fix remaining code coverage issues, hopefully 2021-04-19 23:03:16 -05:00
Noah
b30ca99a09 Implement string interning 2020-11-08 21:35:04 -06:00
Noah
72123c65ec Use siphash24 + PYTHONHASHSEED 2020-08-27 20:47:47 -05:00
Noah
a822ef6275 Mark unsupported tests for test_sys.py, remove redundant test_sys_executable 2020-08-02 21:00:04 -05:00
Noah
e1656149aa Add test/test_sys.py from CPython 3.8.2 2020-08-02 20:57:56 -05:00