From 28370c04509a6255cd3d6b9424443a5b57bb7467 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Wed, 10 Jun 2020 10:45:24 +1000 Subject: 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. --- py/obj.h | 1 + 1 file changed, 1 insertion(+) (limited to 'py/obj.h') diff --git a/py/obj.h b/py/obj.h index 125acf118..468125eb7 100644 --- a/py/obj.h +++ b/py/obj.h @@ -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; } -- cgit v1.2.3