summaryrefslogtreecommitdiffstatshomepage
path: root/py/runtime.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/py/runtime.c b/py/runtime.c
index 6eda77ee9c..c255574643 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -972,7 +972,13 @@ void mp_convert_member_lookup(mp_obj_t self, const mp_obj_type_t *type, mp_obj_t
|| ((mp_obj_base_t*)MP_OBJ_TO_PTR(member))->type->name == MP_QSTR_generator))) {
// only functions, closures and generators objects can be bound to self
#if MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG
- if (self == MP_OBJ_NULL && mp_obj_get_type(member) == &mp_type_fun_builtin) {
+ const mp_obj_type_t *m_type = ((mp_obj_base_t*)MP_OBJ_TO_PTR(member))->type;
+ if (self == MP_OBJ_NULL
+ && (m_type == &mp_type_fun_builtin_0
+ || 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)) {
// we extracted a builtin method without a first argument, so we must
// wrap this function in a type checker
dest[0] = mp_obj_new_checked_fun(type, member);