py/builtinhelp: Don't show help for an MP_MODULE_ATTR_DELEGATION_ENTRY.

Otherwise it can lead to a crash.

Fixes issue #8816.

Signed-off-by: Damien George <damien@micropython.org>
pull/8831/head
Damien George 2022-06-28 16:31:43 +10:00
rodzic e024a4c59c
commit 6e83bb47eb
1 zmienionych plików z 8 dodań i 2 usunięć

Wyświetl plik

@ -149,8 +149,14 @@ STATIC void mp_help_print_obj(const mp_obj_t obj) {
}
if (map != NULL) {
for (uint i = 0; i < map->alloc; i++) {
if (map->table[i].key != MP_OBJ_NULL) {
mp_help_print_info_about_object(map->table[i].key, map->table[i].value);
mp_obj_t key = map->table[i].key;
if (key != MP_OBJ_NULL
#if MICROPY_MODULE_ATTR_DELEGATION
// MP_MODULE_ATTR_DELEGATION_ENTRY entries have MP_QSTRnull as qstr key.
&& key != MP_OBJ_NEW_QSTR(MP_QSTRnull)
#endif
) {
mp_help_print_info_about_object(key, map->table[i].value);
}
}
}