mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Use standard method machinary to call __init__.
This commit is contained in:
@@ -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