summaryrefslogtreecommitdiff
path: root/py/runtime.c
diff options
context:
space:
mode:
authorYonatan Goldschmidt <yon.goldschmidt@gmail.com>2019-12-09 18:31:35 +0200
committerDamien George <damien.p.george@gmail.com>2019-12-21 00:12:08 +1100
commit07ccb5588c4abcffa28f25907e699d1727d38bae (patch)
treeb3a198c7bc563df81bdfd2b6b55c6a589cb9c8df /py/runtime.c
parent90f286465b670feb94c3ce8857c81bad3df18b96 (diff)
py/objobject: Add object.__setattr__ function.
Allows assigning attributes on class instances that implement their own __setattr__. Both object.__setattr__ and super(A, b).__setattr__ will work with this commit.
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/py/runtime.c b/py/runtime.c
index deb82e935..cf4fc5d38 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1038,9 +1038,11 @@ void mp_convert_member_lookup(mp_obj_t self, const mp_obj_type_t *type, mp_obj_t
|| m_type == &mp_type_fun_builtin_1
|| m_type == &mp_type_fun_builtin_2
|| m_type == &mp_type_fun_builtin_3
- || m_type == &mp_type_fun_builtin_var)) {
+ || m_type == &mp_type_fun_builtin_var)
+ && type != &mp_type_object) {
// we extracted a builtin method without a first argument, so we must
// wrap this function in a type checker
+ // Note that object will do its own checking so shouldn't be wrapped.
dest[0] = mp_obj_new_checked_fun(type, member);
} else
#endif