Repository navigation
Raise RuntimeError for a non-type zero-argument super class cell - #9524
Draft
youknowdot wants to merge 1 commit into
Draft
youknowdot wants to merge 1 commit into
youknowdot wants to merge 1 commit into
Conversation
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
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Change one exception constructor in zero-argument
super(): a non-type value in the__class__closure cell raisesRuntimeError, notTypeError. 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:cargo check --offline --locked -j1 --target x86_64-unknown-linux-gnu -p rustpython-vm --lib --features threading, with VM defaults enabled.-- -D warnings.--no-default-features --features threading,stdlib,stdio,importlib,host_env,doc,ucd_3_2_0; actual VM opt-level 3 verified.99andNone: exactRuntimeErrorclass and messages, restoration infinally, and normalsuper()binding afterward.test.test_super.TestSuper.test_obscure_super_errorstest.test_super.TestSuper.test_super_argtypeThe 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-bytrailer.