Commit 6ce78c4f authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

py: Wrap .__class__ handling in MICROPY_CPYTHON_COMPAT.

Because it's superfluos in the presence of type(), a remenant from Python's
"old classes".
parent b509f739
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment