Skip to content

Share native typing constructor binding and validation - #9686

Merged
youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:typing-constructor-controls-group-20261104
Nov 5, 2026
Merged

youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:typing-constructor-controls-group-20261104

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

  • Replace three duplicated constructor parsers with shared raw FromArgs/bind_for layouts and variance checks.
  • Validate names and argument layout before invoking variance truth callbacks, preserving callback and error order.
  • Normalize an explicit TypeVar bound=None and check non-None bounds before constraint count/conflict validation.
  • Keep raw control objects alive through constructor metadata setup while preserving default, bound, name and evaluator identities.

Reference: CPython 3.15.0 native type parameter constructors and generated Clinic wrappers.

Validation

  • Independent source review and bounded CPython 3.15 reference probes cover binding errors, non-string names, variance callbacks/finalizers, bound/constraint ordering, checked-bound None results and identity preservation.
  • Formatting and whitespace checks passed.
  • Normal commit hooks passed.
  • Focused cargo check --locked --offline -j1 -p rustpython-host_env -p rustpython-vm -p rustpython-stdlib --features rustpython-stdlib/threading passed.
  • Strict Clippy with the same packages/features and -- -D warnings passed. This is a focused threading-enabled subset of CI, not the full workspace/all-targets suite.
  • RustPython runtime, full workspace/C-API suites and cross-platform execution were not run. No test, Lib, workflow or marker edits.

Existing caller metadata architecture is unchanged. Argument error wording uses the shared binder's conventions where those differ from CPython. This change preserves TypeVarTuple metadata from #9113 and does not expand into TypeAliasType.

AI assistance: OpenAI Codex performed source comparison, implementation, reference probes and independent source review; model version was not exposed.

Use shared raw argument binding and variance validation for TypeVar,
ParamSpec, and TypeVarTuple. Match name and callback ordering, normalize
TypeVar's explicit None bound before constraint checks, and retain input
objects through caller metadata setup.

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

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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

@youknowone
youknowone marked this pull request as ready for review November 5, 2026 02:17
@youknowone
youknowone merged commit 0b5d33c into RustPython:main Nov 5, 2026
20 checks passed
@chatgpt-codex-connector

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 ⚠️ Failed 2026-11-05T02:17:46.967072Z
We couldn’t complete this review. Comment @codex review to try again.
3f59826 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

2 participants