mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
* Leave Callee out of a generated __text_signature__
The interpreter supplies `callee` the way it supplies `vm`, but only `vm`
was filtered, so the argument surfaced as a Python parameter and left a
string inspect cannot parse:
>>> object.__getstate__.__text_signature__
'(*args, **kwargs, callee)'
>>> inspect.signature(object.__getstate__)
ValueError: builtin has invalid signature
Filter it in `func_sig`, and in `infer_native_call_flags`, which counted
it as a fixed positional argument. `object.__getstate__` is the only
#[pymethod] taking one today, inherited by 95 types.
Assisted-by: Claude Code:claude-opus-5
* Rename maketrans's first parameter to frm
`from` is a Python keyword, so the generated signature could not be
parsed:
>>> bytes.maketrans.__text_signature__
'(from, to, /)'
>>> inspect.signature(bytes.maketrans)
ValueError: builtin has invalid signature
CPython's Argument Clinic spells it `frm` for the same reason. Both
parameters are positional-only, so the name is documentation only.
`bytes.maketrans` and `bytearray.maketrans` now report what CPython
reports, `(frm, to, /)`.
Assisted-by: Claude Code:claude-opus-5