summaryrefslogtreecommitdiff
path: root/py/objexcept.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-07-27 00:38:21 +1000
committerDamien George <damien@micropython.org>2022-03-10 10:35:44 +1100
commit3356b5ef8d1b232a1df493f70f0ba434f293fe11 (patch)
treeeecb3016d1c1b2c87c4eada76c0f35bbe2d0fa6c /py/objexcept.c
parentd470c5a5baa8660461b76585a57f2de28b30f5dc (diff)
py/objmodule: Support delegating failed attr lookups.
This commit adds generic support for mutable module attributes on built in modules, by adding support for an optional hook function for module attribute lookup. If a module wants to support additional attribute load/ store/delete (beyond what is in the constant, globals dict) then it should add at the very end of its globals dict MP_MODULE_ATTR_DELEGATION_ENTRY(). This should point to a custom function which will handle any additional attributes. The mp_module_generic_attr() function is provided as a helper function for additional attributes: it requires an array of qstrs (terminated in MP_QSTRnull) and a corresponding array of objects (with a 1-1 mapping between qstrs and objects). If the qstr is found in the array then the corresponding object is loaded/stored/deleted. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/objexcept.c')
0 files changed, 0 insertions, 0 deletions