mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Use standard method machinary to call __init__.
This commit is contained in:
1 parent
4b52f72316
commit
3a6649ddeb
1 file changed
+2
-4
+2
-4
@@ -469,10 +469,8 @@ impl VirtualMachine {
|
||||
// more or less __new__ operator
|
||||
let dict = self.new_dict();
|
||||
let obj = PyObject::new(PyObjectKind::Instance { dict: dict }, type_ref.clone());
|
||||
let init = type_ref.get_attr(&String::from("__init__"));
|
||||
let mut self_args = PyFuncArgs { args: args.args };
|
||||
self_args.args.insert(0, obj.clone());
|
||||
self.invoke(init, self_args)?;
|
||||
let init = objclass::get_attribute(self, type_ref, obj.clone(), &String::from("__init__"))?;
|
||||
self.invoke(init, args)?;
|
||||
// TODO Raise TypeError if init returns not None.
|
||||
Ok(obj)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user