Skip to content

Commit f13cb62

Browse files
Merge pull request RustPython#357 from veera83372/object-methods
Added __doc__ atrribute for object
2 parents 8a53547 + 3de17b9 commit f13cb62

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

vm/src/obj/objobject.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ fn object_repr(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
8787

8888
pub fn init(context: &PyContext) {
8989
let object = &context.object;
90+
let object_doc = "The most base type";
91+
9092
context.set_attr(&object, "__new__", context.new_rustfunc(new_instance));
9193
context.set_attr(&object, "__init__", context.new_rustfunc(object_init));
9294
context.set_attr(&object, "__eq__", context.new_rustfunc(object_eq));
@@ -105,6 +107,7 @@ pub fn init(context: &PyContext) {
105107
"__getattribute__",
106108
context.new_rustfunc(object_getattribute),
107109
);
110+
context.set_attr(&object, "__doc__", context.new_str(object_doc.to_string()));
108111
}
109112

110113
fn object_init(vm: &mut VirtualMachine, _args: PyFuncArgs) -> PyResult {

0 commit comments

Comments
 (0)