summaryrefslogtreecommitdiffstatshomepage
path: root/py/objboundmeth.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/objboundmeth.c')
-rw-r--r--py/objboundmeth.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/py/objboundmeth.c b/py/objboundmeth.c
index 7698ed29f1..69ae263afc 100644
--- a/py/objboundmeth.c
+++ b/py/objboundmeth.c
@@ -70,6 +70,15 @@ STATIC mp_obj_t bound_meth_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_
}
}
+#if MICROPY_PY_FUNCTION_ATTRS
+STATIC void bound_meth_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+ if(attr == MP_QSTR___name__) {
+ mp_obj_bound_meth_t *o = self_in;
+ dest[0] = MP_OBJ_NEW_QSTR(mp_obj_fun_get_name(o->meth));
+ }
+}
+#endif
+
const mp_obj_type_t bound_meth_type = {
{ &mp_type_type },
.name = MP_QSTR_bound_method,
@@ -77,6 +86,9 @@ const mp_obj_type_t bound_meth_type = {
.print = bound_meth_print,
#endif
.call = bound_meth_call,
+#if MICROPY_PY_FUNCTION_ATTRS
+ .load_attr = bound_meth_load_attr,
+#endif
};
mp_obj_t mp_obj_new_bound_meth(mp_obj_t meth, mp_obj_t self) {