diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-03-31 20:30:08 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-03-31 20:40:31 +0300 |
commit | 6ce78c4fae1a740128efcde74b222593f13a12f4 (patch) | |
tree | ebdc4dd71230bd8f3226c57c3d0d94bcb9230598 | |
parent | b509f73982309e713513830f1c17efef7d912592 (diff) | |
download | micropython-6ce78c4fae1a740128efcde74b222593f13a12f4.tar.gz micropython-6ce78c4fae1a740128efcde74b222593f13a12f4.zip |
py: Wrap .__class__ handling in MICROPY_CPYTHON_COMPAT.
Because it's superfluos in the presence of type(), a remenant from Python's
"old classes".
-rw-r--r-- | py/runtime.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/py/runtime.c b/py/runtime.c index daa555e4a2..f7a55545af 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -716,10 +716,13 @@ STATIC void mp_load_method_maybe(mp_obj_t base, qstr attr, mp_obj_t *dest) { // if nothing found yet, look for built-in and generic names if (dest[0] == MP_OBJ_NULL) { +#if MICROPY_CPYTHON_COMPAT if (attr == MP_QSTR___class__) { // a.__class__ is equivalent to type(a) dest[0] = type; - } else if (attr == MP_QSTR___next__ && type->iternext != NULL) { + } else +#endif + if (attr == MP_QSTR___next__ && type->iternext != NULL) { dest[0] = (mp_obj_t)&mp_builtin_next_obj; dest[1] = base; } else if (type->load_attr == NULL) { |