Skip to content

Commit 76344e5

Browse files
committed
Add object.__init__
1 parent e611533 commit 76344e5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

vm/src/obj/objobject.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,17 @@ fn object_str(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
5959
pub fn init(context: &PyContext) {
6060
let ref object = context.object;
6161
object.set_attr("__new__", context.new_rustfunc(new_instance));
62+
object.set_attr("__init__", context.new_rustfunc(object_init));
6263
object.set_attr("__eq__", context.new_rustfunc(object_eq));
6364
object.set_attr("__ne__", context.new_rustfunc(object_ne));
6465
object.set_attr("__dict__", context.new_member_descriptor(object_dict));
6566
object.set_attr("__str__", context.new_rustfunc(object_str));
6667
}
6768

69+
fn object_init(vm: &mut VirtualMachine, _args: PyFuncArgs) -> PyResult {
70+
Ok(vm.ctx.none())
71+
}
72+
6873
fn object_dict(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
6974
match args.args[0].borrow().kind {
7075
PyObjectKind::Class { ref dict, .. } => Ok(dict.clone()),

0 commit comments

Comments
 (0)