diff options
| author | Philip Peitsch <philip.peitsch@gmail.com> | 2020-06-09 12:34:58 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-01-13 14:21:32 +1100 |
| commit | edc92d18db3e80c95ee565075fbe81f5b79d7df1 (patch) | |
| tree | 01cdfe8804fd655ee64db8bb05717483bd0a3802 | |
| parent | a322ebafc0427f03e1423cf7642b1e6ded5a90a8 (diff) | |
py/map: Clear value when re-using slot with ordered dictionaries.
To adhere to the contract of mp_map_lookup, namely:
MP_MAP_LOOKUP_ADD_IF_NOT_FOUND behaviour:
- returns slot, with key non-null and value=MP_OBJ_NULL if it was added
| -rw-r--r-- | py/map.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -221,6 +221,7 @@ mp_map_elem_t *MICROPY_WRAP_MP_MAP_LOOKUP(mp_map_lookup)(mp_map_t * map, mp_obj_ } mp_map_elem_t *elem = map->table + map->used++; elem->key = index; + elem->value = MP_OBJ_NULL; if (!mp_obj_is_qstr(index)) { map->all_keys_are_qstrs = 0; } |
