diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index c931b91f4c..04ea8f9576 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -460,12 +460,26 @@ extern const struct _mp_obj_module_t ustack_module; #define USTACK_MODULE #endif +// These modules are not yet in shared-bindings, but we prefer the non-uxxx names. +#if MICROPY_PY_UERRNO +#define ERRNO_MODULE + { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) }, +#else +#define ERRNO_MODULE +#endif + #if MICROPY_PY_UJSON #define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) }, #else #define JSON_MODULE #endif +#if MICROPY_PY_URE +#define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) }, +#else +#define RE_MODULE +#endif + // Define certain native modules with weak links so they can be replaced with Python // implementations. This list may grow over time. #define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \ @@ -495,6 +509,7 @@ extern const struct _mp_obj_module_t ustack_module; DIGITALIO_MODULE \ TERMINALIO_MODULE \ DISPLAYIO_MODULE \ + ERRNO_MODULE \ GAMEPAD_MODULE \ I2CSLAVE_MODULE \ JSON_MODULE \ @@ -507,6 +522,7 @@ extern const struct _mp_obj_module_t ustack_module; PIXELBUF_MODULE \ PULSEIO_MODULE \ RANDOM_MODULE \ + RE_MODULE \ RTC_MODULE \ SAMD_MODULE \ STAGE_MODULE \ diff --git a/py/objmodule.c b/py/objmodule.c index 05ec26e481..4ac94311ef 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -179,7 +179,6 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = { // extmod modules #if MICROPY_PY_UERRNO - { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) }, { MP_ROM_QSTR(MP_QSTR_uerrno), MP_ROM_PTR(&mp_module_uerrno) }, #endif #if MICROPY_PY_UCTYPES @@ -189,11 +188,9 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = { { MP_ROM_QSTR(MP_QSTR_uzlib), MP_ROM_PTR(&mp_module_uzlib) }, #endif #if MICROPY_PY_UJSON - { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) }, { MP_ROM_QSTR(MP_QSTR_ujson), MP_ROM_PTR(&mp_module_ujson) }, #endif #if MICROPY_PY_URE - { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) }, { MP_ROM_QSTR(MP_QSTR_ure), MP_ROM_PTR(&mp_module_ure) }, #endif #if MICROPY_PY_UHEAPQ