9 Commits

Author SHA1 Message Date
Jiseok CHOI
192ba371e4 Fix function attribute tests: __defaults__ del, __code__ free vars ch… (#7749)
* Fix function attribute tests: __defaults__ del, __code__ free vars check, bound method dir()

- Support `del func.__defaults__` and `del func.__kwdefaults__` by changing
  setter signatures to `PySetterValue<Option<...>>` so Delete is treated as
  setting the value to None (matching CPython behaviour)
- Validate free-variable count when assigning to `func.__code__`: raise
  ValueError when the new code object's freevars count doesn't match the
  existing closure size
- Add `__dir__` to `PyBoundMethod` that delegates to the underlying
  function's dir(), so attributes set on the function show up in
  `dir(bound_method)`
- Remove `@unittest.expectedFailure` from the four tests that now pass:
  test_blank_func_defaults, test_func_default_args, test___code__,
  test_dir_includes_correct_attrs

* Remove expectedFailure markers for now-passing tests
2026-05-01 22:58:16 +09:00
ShaharNaveh
87cf6848a5 Update test_funcattrs.py from 3.14.3 2026-02-13 13:43:04 +09:00
Jeong, YunWon
684e880689 Implement more ast features (#6986) 2026-02-05 16:20:22 +09:00
Jeong, YunWon
f22aed2614 Fix PyCode constructor/replace (#6193)
* Fix PyCode constructor

* Reuse MarshalError
2025-10-22 21:09:42 +09:00
Jeong, YunWon
1d3603419e SetFunctionAttribute (#5968)
* PyRef::into_non_null

* SetFunctionAttribute

* set_function_attribute

* frame helper in PyFuncion

* remove closure lock

* cleanup unused args
2025-07-15 03:12:23 +09:00
Jeong, YunWon
43302cec4d Fix boundmethod not to have __dict__ + immutable type (#5851) 2025-06-27 22:50:58 +09:00
Jeong, YunWon
52301ddbe5 Fix PyFunction doc behavior (#5827) 2025-06-23 22:37:51 +09:00
Jeong, YunWon
b0b39194dd Fix cell_contents (#5822) 2025-06-23 08:59:07 +09:00
Andrey Maltsev
b1f4606231 Add test_funcattrs.py from Cpython v3.11.2 2023-04-04 08:47:32 +00:00