mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
* Compose native text signatures at compile time from FromArgs FromArgs gains a PARAMS const describing its Python parameters. The derive builds the whole internal doc, `name(sig)\n--\n\ndoc`, in a const context from those params, and `__text_signature__` / `__doc__` parse it from the doc. The macro-time string path and the runtime sig_parts composition are removed. Signatures follow clinic conventions: `$module` for module functions, Rust literal defaults rendered as Python reprs, other defaults as `<unrepresentable>`, and a new `#[pyarg(py_default = "...")]` for the few fields whose Rust default differs from the Python one. The `#[pyarg]` keys are documented on the FromArgs derive. Module functions keep their module object and return it from `__self__`. PyNativeFunction now traverses its references. os.stat, os.mkdir, os.listdir, os.open, dict.fromkeys, round, sorted, int.to_bytes and bytes.hex take arguments matching their signatures. Assisted-by: Grok:grok-4.7 Assisted-by: Claude:claude-opus-5-5 * Update builtin_signature snippet and fix mkdir on Windows round and sum now report their FromArgs parameters, so the snippet asserts their signatures instead of their absence. sum's start is a PyObjectRef defaulting to int 0 with py_default "0". mkdir reads dir_fd only on platforms that use it. Assisted-by: Claude:claude-opus-5-5 * Remove expectedFailure from two signature tests test_cmp_to_signature and test_autospec_on_bound_builtin_function now pass. The TestCmpToKeyC override existed only for the marker. Assisted-by: Claude:claude-opus-5-5