Skip to content

Commit 75eff10

Browse files
committed
Fixed to return the mro function
Fixed to return the mro function to include its own class Fixes #1490
1 parent 2607315 commit 75eff10

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

vm/src/obj/objtype.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,9 @@ impl PyClassRef {
220220
}
221221

222222
fn type_mro(cls: PyClassRef, vm: &VirtualMachine) -> PyObjectRef {
223-
vm.ctx
224-
.new_list(cls.mro.iter().map(|x| x.clone().into_object()).collect())
223+
let mut mro = vec![cls.clone().into_object()];
224+
mro.extend(cls.mro.iter().map(|x| x.clone().into_object()));
225+
vm.ctx.new_list(mro)
225226
}
226227

227228
/*

0 commit comments

Comments
 (0)