Skip to content

Raise RuntimeError for a non-type zero-argument super class cell - #9524

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:upgrade/super-classcell-runtime-error-20261101
Nov 1, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:upgrade/super-classcell-runtime-error-20261101

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Change one exception constructor in zero-argument super(): a non-type value in the __class__ closure cell raises RuntimeError, not TypeError. Keep the error text and every other path unchanged. No Lib files or tests are modified.

This matches CPython 3.15's check at pinned commit d220409. It is a small native prerequisite for the ongoing Python 3.15 library upgrade: the upstream race test catches this RuntimeError, but this PR does not import or enable that test file.

Validation

Validated on base cc5191338ca2ae1b2e13b8d2d2de69e86118554f:

  • Normal repository hooks: merge-conflict check, rustfmt, cspell (unrelated hooks had no matching files).
  • cargo check --offline --locked -j1 --target x86_64-unknown-linux-gnu -p rustpython-vm --lib --features threading, with VM defaults enabled.
  • Matching strict Clippy with -- -D warnings.
  • Lean CLI build using --no-default-features --features threading,stdlib,stdio,importlib,host_env,doc,ucd_3_2_0; actual VM opt-level 3 verified.
  • External sequential probe replacing the class cell with 99 and None: exact RuntimeError class and messages, restoration in finally, and normal super() binding afterward.
  • Exactly two unchanged canonical tests passed normally, without skips or expected failures:
    • test.test_super.TestSuper.test_obscure_super_errors
    • test.test_super.TestSuper.test_super_argtype

The runtime used the exact built interpreter and a read-only candidate Lib snapshot with an isolated import path. Input closures stayed unchanged; each phase ended naturally with one process/thread and no descendants.

Limits

No full test_super, free-threading/test_races, workspace, or C-API suite was run. No CPython 3.15 differential execution was performed; the expected behavior is backed by pinned CPython source. The sequential probe establishes the error contract, not free-threading safety.

OpenAI Codex assisted investigation, implementation, independent review, and bounded validation. The commit includes an Assisted-by trailer.

Match CPython's exception class when the __class__ closure cell contains
something other than a type. Preserve the existing diagnostic and all
other super argument handling.

Validated threaded VM check and strict Clippy, a lean CLI build, an
external deterministic int/None class-cell probe with restoration, and
two unchanged canonical super error tests. Full workspace/C-API and
free-threading suites and a CPython 3.15 differential run were not run.

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

coderabbitai Bot commented Nov 1, 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

@youknowone
youknowone marked this pull request as ready for review November 1, 2026 18:03
@youknowone
youknowone merged commit 123dece into RustPython:main Nov 1, 2026
20 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 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-01T18:06:15.373717Z 7e9d147 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