Skip to content

Commit 123dece

Browse files
youknowdotcodex
andauthored
Raise RuntimeError for a non-type zero-argument super class cell (#9524)
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 Co-authored-by: Codex <[email protected]>
1 parent cc51913 commit 123dece

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎crates/vm/src/builtins/super.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn super_init_without_args(vm: &VirtualMachine) -> PyResult<(PyTypeRef, PyObject
169169
.and_then(|c| c.get())
170170
.ok_or_else(|| vm.new_runtime_error("super(): empty __class__ cell"))?;
171171
typ = Some(class.downcast().map_err(|o| {
172-
vm.new_type_error(format!(
172+
vm.new_runtime_error(format!(
173173
"super(): __class__ is not a type ({})",
174174
o.class().name()
175175
))

0 commit comments

Comments
 (0)