diff options
Diffstat (limited to 'py/runtime.c')
-rw-r--r-- | py/runtime.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/py/runtime.c b/py/runtime.c index 3926f89ce..9b5527d72 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1056,12 +1056,14 @@ void mp_load_method_maybe(mp_obj_t obj, qstr attr, mp_obj_t *dest) { const mp_obj_type_t *type = mp_obj_get_type(obj); // look for built-in names -#if MICROPY_CPYTHON_COMPAT + #if MICROPY_CPYTHON_COMPAT if (attr == MP_QSTR___class__) { // a.__class__ is equivalent to type(a) dest[0] = MP_OBJ_FROM_PTR(type); - } else -#endif + return; + } + #endif + if (attr == MP_QSTR___next__ && type->iternext != NULL) { dest[0] = MP_OBJ_FROM_PTR(&mp_builtin_next_obj); dest[1] = obj; |