Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitba8990e

Browse files
committed
Fix check that __init__ must return None.
1 parentbcdb208 commitba8990e

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
ifletOk(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+
returnErr(vm.new_type_error("__init__ must return None".to_string()));
128126
}
129127
}
130128
Ok(obj)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp