summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnson Mansfield <amansfield@mantaro.com>2025-12-05 15:26:25 -0500
committerDamien George <damien@micropython.org>2025-12-07 18:22:43 +1100
commit84061266ece6ea9fae7da45e47cc6e1c51182c8a (patch)
tree0b2266f4612cae5a11f1eadef716a7e80510d670
parent45385994752c1ee30d115bd77165449e918b3daf (diff)
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>
-rw-r--r--py/builtinhelp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/py/builtinhelp.c b/py/builtinhelp.c
index dc4fe582f..5a84b3d7d 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);
}
}
}