Commit Graph
7792 Commits
Author SHA1 Message Date
Shahar Naveh 9792001703 Add newtype of CodeUnits (#6241) 2025-11-10 09:48:25 +09:00
Jeong, YunWon d8a4a09ec0 Fix #[pyclass(base=...)] notation (#6242) 2025-11-10 09:47:57 +09:00
Shahar Naveh a7e8ac684b Remove user defined docstrings (#6232) 2025-11-02 00:01:02 +09:00
Jiseok CHOI e096ce7bc7 Implement property.__name__ attribute (#6230)
* Implement property.__name__ attribute

Add getter and setter for the __name__ attribute on property objects.
The getter returns the explicitly set name if available, otherwise
falls back to the getter function's __name__. Raises AttributeError
if no name is available, matching CPython 3.13 behavior.

The implementation handles edge cases:
- Returns None when explicitly set to None
- Propagates non-AttributeError exceptions from getter's __getattr__
- Raises property-specific AttributeError when getter lacks __name__

This fix enables test_property_name in test_property.py to pass.

* Refactor to use get_property_name in __name__ implementation

Consolidate duplicate logic by making name_getter() use the existing
get_property_name() helper method. This eliminates code duplication
and improves maintainability.

Changes:
- Update get_property_name() to return PyResult<Option<PyObjectRef>>
  to properly handle and propagate non-AttributeError exceptions
- Simplify name_getter() to delegate to get_property_name()
- Update format_property_error() to handle the new return type

This addresses review feedback about the relationship between
get_property_name() and __name__ implementation.

* style comment
2025-11-01 18:30:03 +09:00
Jiseok CHOI 9e7d291b63 Add callable validation to codecs.register_error (#6229)
Validate that the handler argument passed to codecs.register_error
is callable, raising TypeError with message 'handler must be callable'
if it is not. This matches CPython behavior.

This fix enables test_badregistercall in test_codeccallbacks.py to pass.
2025-10-31 00:08:04 +09:00
Yash Suthar 8f048dd9fd Implement minimal builtins.anext() (#6226)
* Implement minimal builtins.anext()

* Removed expectedFailure for builtins.anext() tests

* Removed expectedFailure from test_contextlib_async tests fixed by anext

---------

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
2025-10-29 19:09:37 +09:00
Yash Suthar b6e8a875ac Resolve number slots via MRO in PyNumber and operator, ensure inherit… (#6222)
* Resolve number slots via MRO in PyNumber and operator, ensure inherited and dynamically added methods are found.

Use class().mro_find_map() to mimic the same behaviour as CPython.

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
2025-10-28 12:00:22 +09:00
Christopher GambrellandJeong, YunWon 6b25fe5c95 5539 - CTRL+Z then Enter will now close shell on Windows. (#6223)
* CTRL+Z then Enter will now close shell on Windows.

* Additional comment.

* Use EOF const

* Add cfg(windows) for EOF_CHAR

---------

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2025-10-28 11:02:24 +09:00
Jeong YunWon 517b55b8b5 pyssl errors 2025-10-27 18:37:01 +09:00
Jeong, YunWon 2463bdff0e Fix time.strptime (#6208) 2025-10-23 17:28:53 +09:00
Jeong, YunWon f22aed2614 Fix PyCode constructor/replace (#6193)
* Fix PyCode constructor

* Reuse MarshalError
2025-10-22 21:09:42 +09:00
winlogon b15e537692 Use PyStrRef for TypeAliasType name (#6203)
* fix(PyStrRef): fix TODO in typing.rs where PyObjectRef was used

* chore(fmt): apply rustfmt to code
2025-10-21 12:14:57 +09:00
Shahar NavehandNoa fcf196935e Update ruff 0.14.1 (#6195)
* Update ruff to 0.14.1

* Fix test regression in `test_compile`

* Unmark passing test

* Update `test_syntax` from 3.13.9

---------

Co-authored-by: Noa <coolreader18@gmail.com>
2025-10-20 22:46:46 +09:00
Anton b56e469a5f Handle OsError in REPL (#6187) 2025-10-13 10:18:51 +09:00
Shahar Naveh 3a6fda4daf Update opcode from 3.13.7 (#6156)
* Update `opcode` from 3.13.7

* Base `_opcode`

* Add `test__opcode.py` from 3.13.7

* Impl `has_*` methods

* Add more methods

* Update `dis.py` from 3.13.7

* Update `support/bytecode_helper.py` from 3.13.7

* correct is_valid

* Patch failing tests

* Unpatch `support/__init__.py`

* clippy

* Make comments to doc

* impl `_varname_from_oparg` for code

* Unmark passing tests

* Revert changes to `dis`

* Mark failing tests
2025-10-05 11:14:33 +09:00
Jeong, YunWon aa0eb4bedf rustpython-common wasm_js feature (#6116) 2025-09-17 09:11:13 +09:00
Shahar Naveh 141ed72693 Dependencies cleanup (#6151)
* Update deps

* Remove some unused deps

* Update lockfile
2025-09-17 09:10:35 +09:00
Jeong, YunWon b666c52df9 code object linetable (#6150)
* Code.replace

* implement linetable
2025-09-16 21:49:54 +09:00
Shahar Naveh 7044d43dc8 Update {site,sysconfig}.py from 3.13.7 (#6132)
* Update `{site,sysconfig}.py` from 3.13.7

* Update vm/src/stdlib/sysconfig.rs
2025-09-08 13:48:51 +09:00
Shahar Naveh da71b92dd3 Pickle warning for itertools (#6129) 2025-09-07 16:10:22 +09:00
Jeong, YunWon b640ef1241 Add comment about 6 params (#6125) 2025-09-07 16:06:49 +09:00
Noa 85ca28094e Apply clippy suggestions to switch to let chains (#6126) 2025-09-04 15:34:10 +09:00
xgampx 48d8031f0c lookup slot in hash() (#6102)
* avoid get_class_attr for __hash__; read hash slot via mro_find_map

Reduce calls and lock acquisitions on hot paths by bypassing get_class_attr(__hash__) and directly resolving the hash implementation with mro_find_map(|cls| cls.slots.hash.load()).

* fix linting in hash function
2025-09-03 23:32:15 -05:00
Noa 0c8ae3a384 Update nix to 0.30 (#6120) 2025-09-04 08:44:27 +09:00
Shahar Naveh 056795eed4 Attenpt to automate posix consts (#6117) 2025-09-03 22:19:30 +09:00
Noa cca4fe6d80 Switch to newer thread::LocalKey convenience methods (#6123) 2025-09-03 22:14:59 +09:00
Shahar Naveh 8b6e1e398b Update test_itertools.py to 3.13.7 (#6122)
* Update `test_itertools.py` to 3.13.7

* Apply patch where test name was changed

* Fix some failing tests
2025-09-02 20:19:57 +09:00
Noa dc4be47751 Windows fixes 2025-08-29 10:59:53 -05:00
Noa 51cbf57470 Rework crt_fd to be more aligned with io-safety 2025-08-29 10:59:51 -05:00
Jeong YunWon f4543f5f51 Fix defaultdict 2025-08-26 21:49:26 +09:00
Jeong YunWon be54bc0dfd Fix multiple inheritance 2025-08-26 21:49:10 +09:00
Jeong YunWon b807bc7fc4 Fix patma guard 2025-08-26 21:48:46 +09:00
Jeong YunWon 21fb4aafcf apply review 2025-08-26 21:48:46 +09:00
Jeong YunWon 8ae2dc75f6 MATCH_SELF 2025-08-26 21:48:46 +09:00
Jeong YunWon 50c557419e more match pattern 2025-08-26 21:48:46 +09:00
Jeong, YunWon c6d1a5784a Fix mkdir error args (#6114) 2025-08-26 20:46:22 +09:00
Jeong, YunWon 776cabb883 New Instruction ToBool,PopJumpIfFalse (#6112)
* New Instruction ToBool

* Rename JustIf{True,False} => PopJumpIf{...}
2025-08-26 16:12:14 +09:00
Jeong, YunWon 16cdcfb96f Fix PyNumber::boolean (#6111) 2025-08-26 15:16:47 +09:00
Jeong, YunWon 711b1a62d5 PyTypeFlags::{SEQUENCE,MAPPING} (#6109) 2025-08-26 10:42:05 +09:00
Jeong, YunWon dae95849ea Update some tests from 3.13.7 (#6108)
* Update `test_opcache.py`

* Update test_optparse.py

* Add some missing folders & test files

* Update `test_long.py` and impl "is_integer" for int

* Update `support/hypothesis_helper.py` from 3.13.7

* Update test_binascii

* Update test_math

* Add `test_math_property.py`

* Update `test_property.py` from 3.13.7

* Update `test_cmath.py` from 3.13.7

* Unmark passing tests

* Update `test_ucn.py` from 3.13.7

* Mark failing tests

* Add `site-packages` dir
2025-08-24 17:44:31 +09:00
Shahar Naveh 5c6f92d497 Fix unused imports for android (#6106) 2025-08-24 17:04:09 +09:00
ShaharNaveh 933db1075f Update test_long.py and impl "is_integer" for int 2025-08-23 21:43:35 +03:00
Shahar Naveh ceb7046bc4 Fix int respect sys.set_int_max_str_digits value (#6094) 2025-08-21 13:14:10 +09:00
Jeong, YunWon bfc513e997 Fix future clippy warnings (#6103) 2025-08-20 17:34:29 +09:00
Shahar Naveh e6001a48d7 Update netrc.py from 3.13.6 and make pwd accesible on Android (#6083) 2025-08-20 14:08:05 +09:00
Jeong, YunWon ddc08498cc Fix match mapping pattern (#6081) 2025-08-20 13:26:18 +09:00
Jeong YunWon d56fcd0774 DictUpdate instruction 2025-08-08 23:53:40 +09:00
Jiseok CHOI e922722191 Implement type check in member descriptor __set__ (#6080) 2025-08-08 19:45:15 +09:00
Shahar Naveh 133aada0b7 Update os.py from 3.13.5 (#6076)
* Update `os.py` from 3.13.5

* Set availablity of some `os` functions

* revert some cfg

* Mark more failing tests
2025-08-08 14:37:35 +09:00
Jeong, YunWon 4ae5a1f894 Fix ImportError fields (#6079) 2025-08-07 18:29:05 +09:00