From 84061266ece6ea9fae7da45e47cc6e1c51182c8a Mon Sep 17 00:00:00 2001 From: Anson Mansfield Date: Fri, 5 Dec 2025 15:26:25 -0500 Subject: [PATCH] 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: #18061 Fixes: #18481 Signed-off-by: Anson Mansfield --- py/builtinhelp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/py/builtinhelp.c b/py/builtinhelp.c index dc4fe582f7..5a84b3d7d2 100644 --- a/py/builtinhelp.c +++ b/py/builtinhelp.c @@ -152,9 +152,8 @@ static void mp_help_print_obj(const mp_obj_t obj) { } if (map != NULL) { for (uint i = 0; i < map->alloc; i++) { - mp_obj_t key = map->table[i].key; - if (key != MP_OBJ_NULL) { - mp_help_print_info_about_object(key, map->table[i].value); + if (mp_map_slot_is_filled(map, i)) { + mp_help_print_info_about_object(map->table[i].key, map->table[i].value); } } }