8 Commits

Author SHA1 Message Date
Shahar Naveh
3c297d478a Update test_call.py to 3.14.4 (#7730) 2026-04-30 04:40:44 +09:00
Changjoon
ba2b619c0c Accept __index__-conforming objects for compile() flags / optimize (#7728)
CPython's compile() (Python/Python-ast.c) accepts any object with
__index__ for the flags and optimize arguments. RustPython's CompileArgs
typed both fields as OptionalArg<PyIntRef>, so a class with only
__index__ raised 'TypeError: Expected type int but X found' during arg
binding.

bpo-36907's regression test (test_call.test_fastcall_clearing_dict)
exercises exactly this: an IntWithDict.__index__ that mutates
self.kwargs mid-call. CPython parses both args via __index__ and doesn't
crash even when the kwargs dict is cleared between binding and use.

Switch flags and optimize to OptionalArg<ArgPrimitiveIndex<i32>>, the
same helper already used by range, slice, bytes.__mul__, hex, oct, etc.
ArgPrimitiveIndex calls try_index (= __index__ protocol) and converts
to the requested primitive in one step, so the three call sites in
compile() simplify from .map_or(Ok(d), |v| v.try_to_primitive(vm))? to
.map_or(d, |v| v.value).

Unmasks test_call.FastCallTests.test_fastcall_clearing_dict.
2026-04-29 18:26:49 +09:00
Shahar Naveh
3c01be29c4 Update some tests to 3.13.7 (#6171)
* Update `test_call.py` from 3.13.7

* Update `test_yield_from.py` from 3.13.7

* Update more tests to 3.13.7

* More tests to 3.13.7

* Remove patch from passing test
2025-09-21 19:33:41 +09:00
Jeong YunWon
9467632e1b Fix dict unpacking order preservation 2025-06-21 23:51:37 +09:00
Padraic Fanning
5ac76c78e6 Clean up skip(s) in test_call 2021-10-10 19:11:23 -04:00
Padraic Fanning
a7b759c773 Skip TestPEP590 per lack of vectorcall support 2021-02-15 22:34:19 -05:00
Padraic Fanning
5c7f758bde Mark failing/erroring tests 2021-02-15 15:01:19 -05:00
Padraic Fanning
2cc168df21 Add test_call from CPython 3.8.7 2021-02-15 14:57:36 -05:00