py/map: Replace always-false condition with assertion.

This commit is contained in:
Damien George 2017-08-31 16:45:02 +10:00
parent 09547f0f51
commit 0e420d48ee

View File

@ -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;