⚡ Sangsakala Proxy 🏠 Home
Skip to content

Share native typing constructor binding and validation - #9686

Draft
youknowdot wants to merge 2 commits into
RustPython:mainfrom
youknowdot:typing-constructor-controls-group-20261104
Draft

youknowdot wants to merge 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

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

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.

1 participant