Skip to content

Commit ba8990e

Browse files
committed
Fix check that __init__ must return None.
1 parent bcdb208 commit ba8990e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

vm/src/obj/objtype.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@ pub fn type_call(vm: &mut VirtualMachine, mut args: PyFuncArgs) -> PyResult {
121121

122122
if let Ok(init) = vm.get_method(obj.clone(), "__init__") {
123123
let res = vm.invoke(init, args)?;
124-
// TODO: assert that return is none?
125-
if !isinstance(&res, &vm.get_none()) {
126-
// panic!("__init__ must return none");
127-
// return Err(vm.new_type_error("__init__ must return None".to_string()));
124+
if !res.is(&vm.get_none()) {
125+
return Err(vm.new_type_error("__init__ must return None".to_string()));
128126
}
129127
}
130128
Ok(obj)

0 commit comments

Comments
 (0)