Skip to content

Commit 8406126

Browse files
AJMansfielddpgeorge
authored andcommitted
py/builtinhelp: Don't print removed sentinel entries.
This fixes the test used by the help function to iterate over its argument's attribute to use the proper `mp_map_slot_is_filled` function to check if a slot in the map is filled; the previous test only checked for `MP_OBJ_NULL` keys and would attempt to print the null value whenever a `MP_OBJ_SENTINEL` key marking a deleted entry was present. Fixes: micropython#18061 Fixes: micropython#18481 Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
1 parent 4538599 commit 8406126

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

py/builtinhelp.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,8 @@ static void mp_help_print_obj(const mp_obj_t obj) {
152152
}
153153
if (map != NULL) {
154154
for (uint i = 0; i < map->alloc; i++) {
155-
mp_obj_t key = map->table[i].key;
156-
if (key != MP_OBJ_NULL) {
157-
mp_help_print_info_about_object(key, map->table[i].value);
155+
if (mp_map_slot_is_filled(map, i)) {
156+
mp_help_print_info_about_object(map->table[i].key, map->table[i].value);
158157
}
159158
}
160159
}

0 commit comments

Comments
 (0)