Commit Graph

68 Commits

Author SHA1 Message Date
Lee Dogeon
9ddd07a656 Preserve imaginary zero signs when adding real values to complex numbers (#7421)
* Preserve imaginary zero signs when adding real values to complex numbers

* Refactor complex_add with match expression

* Correct complex real subtract op

* Remove unnecessary vm arugment
2026-03-15 17:04:23 +09:00
Lee Dogeon
d1ea35962b Match divmod zero-division message with CPython (#7426) 2026-03-14 20:21:23 +09:00
Lee Dogeon
e7d2b57dcc Match __module__ setter behavior to CPython (#7424)
* Remove stale __firstlineno__ when updating type.__module__

* Register and use __firstlineno__ as identifier
2026-03-14 15:48:48 +09:00
Lee Dogeon
21d549caf6 Handle chr() range checks without Rust integer overflow (#7422) 2026-03-14 15:47:45 +09:00
Lee Dogeon
ed032d31fb Make singleton builtin types immutable (#7423) 2026-03-14 09:45:43 +09:00
김은빈
61b3b4f42b Add strict parameter to map() builtin (#7405)
* Add strict parameter to map() builtin

* Refactor map IterNext to match zip style
2026-03-12 15:02:53 +00:00
Jeong, YunWon
684e880689 Implement more ast features (#6986) 2026-02-05 16:20:22 +09:00
Shahar Naveh
27d70fd58e Update test_builtin.py from 3.14.2 (#6979)
* Update `test_builtin.py` from 3.14.2

* Mark haning/segfault tests

* Patch failing tests
2026-02-03 21:55:55 +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
8d901a7300 Implement bool(NotImplemented) 2026-01-17 19:21:10 +09:00
Padraic Fanning
98d8ebcc1d Skip test causing worker bug in test_builtin 2026-01-10 22:10:35 -05:00
Terry Tianlin Luan
75838e567e Update pty + tty + associated libraries - v3.13.10 (#6630)
* Update tty + added the test from v3.13.10

* Updated pty.py + test
2026-01-05 14:38:04 +09:00
Jeong, YunWon
7edc3bba5d tp_itemsize (#6544) 2025-12-28 10:27:58 +09:00
Jeong, YunWon
9b2ad34a08 check surrogates (#6547) 2025-12-28 00:06:29 +09:00
Jeong, YunWon
75ecd72428 test_builtin.test_import (#6546)
* fix warnings

* fix test_import
2025-12-27 21:38:12 +09:00
Jeong, YunWon
4592787946 get_inheritable, dup for windows (#6343) 2025-12-08 23:55:03 +09:00
Noa
7d05f881c4 Have rustpython_literal::escape support wtf8 2025-03-28 11:26:29 +09:00
Snowapril
aa0353a501 Fix best_base to select proper base class (#5324)
* add __basicsize__ getter

* modify best_base function to get proper base

* inherit basicsize from the base type

---------

Signed-off-by: snowapril <sinjihng@gmail.com>
2024-05-19 15:48:56 +09:00
hydrogen602
61feb43aba test_builtin.py: test_type_qualname fix 2024-05-13 14:18:18 +09:00
hydrogen602
af8bed6d3f filter out doc strings with opt level 2 2024-04-25 16:11:04 +09:00
Jonathan Rotter
3313fdeb32 test_builtin.py test_compile unit test fix (#5251)
* compile accepts memoryview now

* Update test_compile to what it is in CPython3.12

* compile optimize flag

* added undocumented flags to flag validator
2024-04-23 14:07:02 +09:00
Jeong, YunWon
49cfcd817d remove some skipIf and enable shutil CI for windows (#5235)
* mark failing shtuil tests in windows

* unsetenv raise more informed error

* Remove a few skipIf for windows
2024-04-20 03:00:27 +09:00
Moreal
21c5eae717 Add testcase for __ne__ method 2024-04-14 13:07:13 +09:00
Ankit Kumar Pandey
058f8c5500 Add fork support functions (#4972) 2023-06-01 15:29:16 +09:00
Ankit Kumar Pandey
322aa6887a add support for os.fork and related functions (#4877) 2023-04-25 02:39:54 +09:00
Jaeyoung Ahn
096a3dc645 Fix builtins (has,get,set)attr type error messages (#4776) 2023-03-27 15:22:11 +09:00
JaeyoungAhn
44da572893 uncomment annotation 2023-03-25 22:19:15 +09:00
JaeyoungAhn
f750c0ca06 added back the skipIf for windows 2023-03-25 22:13:50 +09:00
JaeyoungAhn
0873e451a8 update test_builtin.py from cpython v3.11.2 2023-03-25 20:30:40 +09:00
JaeyoungAhn
0eea760443 Update test_builtin.py from CPython v3.11.2 2023-03-25 20:17:27 +09:00
yt2b
42e6eecf7f Remove the decorator 2022-12-28 22:18:21 +09:00
Devon Hollowood
052b87b6e7 Fix compatibility bug for min/max builtins
This was as simple as fixing the error messages produced when zero
arguments are passed.
2022-10-19 22:34:15 -07:00
Gyubong
e9970edd77 Add built-in breakpoint function (#4122) 2022-08-23 21:45:01 +09:00
Jeong Yunwon
3d27f163e4 adjust failing markers for test_{builtin,decimal,float,range} 2022-07-18 04:38:26 +09:00
CPython developers
33690be35b Update tests from CPython 3.10.5 2022-07-18 04:07:35 +09:00
Jeong YunWon
bd4f7ab3f9 Merge pull request #3734 from gnsxun/map-mod
Add map.reduce()
2022-05-22 13:52:54 +09:00
gnsxun
d1f22fe4c3 delete expectedFailtures 2022-05-22 12:40:57 +09:00
Lithium
53185cdfb8 Fixed test_bytearray_translate Error (#3730) 2022-05-22 10:57:12 +09:00
Hyun Park
dfa4bdc695 add filter.__reduce__ (#3732) 2022-05-21 19:08:20 +09:00
Moreal
d6236dcdcc Unmark correct tests 2022-04-24 05:31:01 +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
Daniel Watkins
2960ebc0d1 test/test_builtin.py: run most of test_type_name
The remaining failures are due to what appears to be a fundamental
difference between how RustPython and CPython handle surrogate
characters/codepoints-which-aren't-characters.  They are wrapped with
`self.assertRaises(AssertionError)` so we will notice once they start
passing.

https://github.com/RustPython/RustPython/issues/935 is most likely
related.
2022-04-16 00:38:12 +09: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
jfh
dce45825ae Allow any mapping for locals. 2021-10-15 17:34:52 +03:00
snowapril
30a37b5baf remove decorator on unexpected success test
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-06 20:25:10 +09:00
snowapril
53e8c77c3b add zip related tests from cpython 3.10
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-06 20:25:10 +09:00
Aphek
1ff85118fc Fix test_chr by raising a ValueError on chr(-1) instead of OverflowError 2021-10-05 12:40:20 -03:00
jfh
b6b10149b7 Fix test_vars in test_builtins. 2021-06-16 19:48:54 +03:00