diff options
author | Damien George <damien.p.george@gmail.com> | 2017-08-31 16:45:02 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-08-31 16:45:02 +1000 |
commit | 0e420d48eea1357275a7e418463f88d254049fb6 (patch) | |
tree | a04e1a49c81eddcf16a0846c6d2555ee481e5044 | |
parent | 09547f0f510b809bd41b554363056ebc6af45c6c (diff) |
py/map: Replace always-false condition with assertion.
-rw-r--r-- | py/map.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -148,11 +148,8 @@ STATIC void mp_map_rehash(mp_map_t *map) { // MP_MAP_LOOKUP_REMOVE_IF_FOUND behaviour: // - returns NULL if not found, else the slot if was found in with key null and value non-null mp_map_elem_t *mp_map_lookup(mp_map_t *map, mp_obj_t index, mp_map_lookup_kind_t lookup_kind) { - - if (map->is_fixed && lookup_kind != MP_MAP_LOOKUP) { - // can't add/remove from a fixed array - return NULL; - } + // If the map is a fixed array then we must only be called for a lookup + assert(!map->is_fixed || lookup_kind == MP_MAP_LOOKUP); // Work out if we can compare just pointers bool compare_only_ptrs = map->all_keys_are_qstrs; |