From 0e420d48eea1357275a7e418463f88d254049fb6 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 31 Aug 2017 16:45:02 +1000 Subject: [PATCH] py/map: Replace always-false condition with assertion. --- py/map.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/py/map.c b/py/map.c index 7f3c90059..6d6337229 100644 --- a/py/map.c +++ b/py/map.c @@ -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;