Skip to content

Commit 0e420d4

Browse files
committed
py/map: Replace always-false condition with assertion.
1 parent 09547f0 commit 0e420d4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

py/map.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,8 @@ STATIC void mp_map_rehash(mp_map_t *map) {
148148
// MP_MAP_LOOKUP_REMOVE_IF_FOUND behaviour:
149149
// - returns NULL if not found, else the slot if was found in with key null and value non-null
150150
mp_map_elem_t *mp_map_lookup(mp_map_t *map, mp_obj_t index, mp_map_lookup_kind_t lookup_kind) {
151-
152-
if (map->is_fixed && lookup_kind != MP_MAP_LOOKUP) {
153-
// can't add/remove from a fixed array
154-
return NULL;
155-
}
151+
// If the map is a fixed array then we must only be called for a lookup
152+
assert(!map->is_fixed || lookup_kind == MP_MAP_LOOKUP);
156153

157154
// Work out if we can compare just pointers
158155
bool compare_only_ptrs = map->all_keys_are_qstrs;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy