py/makemoduledefs.py: Avoid empty extensible module lists.

An empty array is a C extension supported by clang & GCC but not MSVC.

This also saves a bit of code size if there are no extensible modules.

Fixes issue #18141.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
Jeff Epler
2025-09-26 10:23:06 -05:00
committed by Damien George
parent 653f7784d7
commit 41284577ca
6 changed files with 37 additions and 8 deletions

View File

@@ -79,7 +79,9 @@ static void mp_help_print_modules(void) {
mp_obj_t list = mp_obj_new_list(0, NULL);
mp_help_add_from_map(list, &mp_builtin_module_map);
#if MICROPY_HAVE_REGISTERED_EXTENSIBLE_MODULES
mp_help_add_from_map(list, &mp_builtin_extensible_module_map);
#endif
#if MICROPY_MODULE_FROZEN
extern const char mp_frozen_names[];