diff options
| author | Andrew Leech | 2020-06-10 10:45:24 +1000 |
|---|---|---|
| committer | Damien George | 2020-06-10 21:58:13 +1000 |
| commit | 28370c04509a6255cd3d6b9424443a5b57bb7467 (patch) | |
| tree | 98d1f78a1805d14b85a88e54c910e0cf46168598 /py/obj.h | |
| parent | 29e258611ace8e4de51d810d5ff14364a5fbb950 (diff) | |
py/objtype: Add __dict__ attribute for class objects.
The behavior mirrors the instance object dict attribute where a copy of the
local attributes are provided (unless the dict is read-only, then that dict
itself is returned, as an optimisation). MicroPython does not support
modifying this dict because the changes will not be reflected in the class.
The feature is only enabled if MICROPY_CPYTHON_COMPAT is set, the same as
the instance version.
Diffstat (limited to 'py/obj.h')
| -rw-r--r-- | py/obj.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -895,6 +895,7 @@ size_t mp_obj_dict_len(mp_obj_t self_in); mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index); mp_obj_t mp_obj_dict_store(mp_obj_t self_in, mp_obj_t key, mp_obj_t value); mp_obj_t mp_obj_dict_delete(mp_obj_t self_in, mp_obj_t key); +mp_obj_t mp_obj_dict_copy(mp_obj_t self_in); static inline mp_map_t *mp_obj_dict_get_map(mp_obj_t dict) { return &((mp_obj_dict_t *)MP_OBJ_TO_PTR(dict))->map; } |
