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 <amansfield@mantaro.com>
This commit is contained in:
Anson Mansfield
2025-12-05 15:26:25 -05:00
committed by Damien George
parent 4538599475
commit 84061266ec

View File

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