aboutsummaryrefslogtreecommitdiff
path: root/py/obj.h
diff options
context:
space:
mode:
authorLaurens Valk <laurens@pybricks.com>2020-07-17 22:31:09 +0200
committerDamien George <damien@micropython.org>2021-11-22 12:10:35 +1100
commite2ca8ab8fc2f824dc7ebaa8fe65c4d2e7891080e (patch)
tree1a213f08c2d35b2fb0c94d3b0ff6a08dab4a93b5 /py/obj.h
parent01ceb9aca3707114dc05b7a45691074b3603a274 (diff)
py/runtime: Allow types to use both .attr and .locals_dict.
Make it possible to proceed to a regular lookup in locals_dict if the custom type->attr fails. This allows type->attr to extend rather than completely replace the lookup in locals_dict. This is useful for custom builtin classes that have mostly regular methods but just a few special attributes/properties. This way, type->attr needs to deal with the special cases only and the default lookup will be used for generic methods. Signed-off-by: Laurens Valk <laurens@pybricks.com>
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/py/obj.h b/py/obj.h
index 11918ba17..7730059e6 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -551,6 +551,7 @@ struct _mp_obj_type_t {
//
// dest[0] = MP_OBJ_NULL means load
// return: for fail, do nothing
+ // for fail but continue lookup in locals_dict, dest[1] = MP_OBJ_SENTINEL
// for attr, dest[0] = value
// for method, dest[0] = method, dest[1] = self
//