Skip to content

Commit a2960bf

Browse files
committed
Inherit static type slots from the whole MRO
extend_class copied slots only from the direct bases, and tp_init is copied only from a base that defines it, so TabError missed the SyntaxError init that IndentationError inherits. Walk the MRO the same way init_slots does. Assisted-by: Grok:4.7 Assisted-by: Claude:claude-opus-5-5
1 parent 25cfed3 commit a2960bf

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎crates/vm/src/class.rs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,14 @@ pub trait PyClassImpl: PyClassDef {
303303
// Add slot wrappers using SLOT_DEFS array
304304
add_operators::<Self>(class, ctx);
305305

306-
// Inherit slots from base types after slots are fully initialized
307-
for base in class.bases.read().iter() {
306+
// Same walk as init_slots: a slot such as tp_init is copied only from
307+
// a base that defines it, so a static grandchild must see that base
308+
// in the MRO, not only its direct bases.
309+
let mro = {
310+
let guard = class.mro.read();
311+
guard[1..].to_vec()
312+
};
313+
for base in &mro {
308314
class.inherit_slots(base);
309315
}
310316

0 commit comments

Comments
 (0)