Skip to content

Align core callable signatures and argument contracts - #9538

Merged
youknowone merged 6 commits into
RustPython:mainfrom
youknowdot:fix-core-signature-contracts-20261102
Nov 3, 2026
Merged

youknowone merged 6 commits into
RustPython:mainfrom
youknowdot:fix-core-signature-contracts-20261102

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Scope

Follow up 15 concrete signature mismatches in the existing whats_left CI report against CPython 3.15.0. This is not a claim that the full signature inventory is fixed.

  • Preserve omitted-vs-explicit-None behavior while supplying CPython Clinic display defaults for __lazy_import__ and _warnings.warn.
  • Align AST, profiler callback, and JSON encoder parameter names.
  • Give JSON scanstring its actual positional/default metadata and use truth conversion for strict (the prior Rust bool converter only accepted integers).
  • Accept the Clinic-supported keywords for the two sys lazy-import setters.
  • Require exactly three positional arguments to lock/RLock __exit__ before releasing, rather than accepting arbitrary varargs.
  • Include the already reviewed --signature output option on the existing CI comparison command; it only prints details the script already computes, without adding scans/imports.

Two pure Rust tests check the actual warning/lazy-import parameter metadata. No Lib tests, assertions, snippets, dependencies or generic binder ordering are changed.

Validation

  • Independent source review against pinned CPython d220409a13b77de7a6c30abe16ea90db01528edc: passed.
  • Normal repository commit hooks and diff whitespace check: passed.
  • Local Cargo compilation/tests and interpreter execution: not run; local dependency-cache/network restoration remains blocked. CI validation is pending for this exact head.
  • The 15-item reduction is a source-based expectation, not yet an observed after-report. Existing full suites and the detailed comparator will measure it.

Remaining differences include warning stacklevel's i32 width vs Py_ssize_t and generic invalid-call error priority. This patch does not establish complete runtime or error-message parity.

codex added 2 commits November 2, 2026 22:04
Preserve Clinic display defaults without collapsing omitted arguments. Match JSON truth conversion, lazy setter keywords, and lock exit arity.

Assisted-by: OpenAI Codex:model version not exposed
Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

Assisted-by: OpenAI Codex:model version not exposed
#[pyarg(any)]
name: PyObjectRef,
#[pyarg(any, optional)]
#[pyarg(any, optional, py_default = "None")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if default is required, isn't it betterto model it as Option and default = None?

Assisted-by: OpenAI Codex:model version not exposed
@codspeed

codspeed Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:fix-core-signature-contracts-20261102 (8e138f4) with main (7f50ac2)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

codex added 2 commits November 3, 2026 05:57
Preserve pointer-width warning stack levels alongside signature defaults.

Assisted-by: OpenAI Codex:model version not exposed
Category and source already treat omitted and explicit None identically. Represent that contract with Option and a typed default instead of text-only signature overrides.

Assisted-by: OpenAI Codex:model version not exposed
@youknowone
youknowone marked this pull request as ready for review November 3, 2026 03:59
@youknowone
youknowone merged commit a7e279e into RustPython:main Nov 3, 2026
29 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T04:03:46.460714Z 8e138f4 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants