Skip to content

Commit ba77a9c

Browse files
committed
move non-u names for native modules to circuitpy_mpconfig.h
1 parent 339a227 commit ba77a9c

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

py/circuitpy_mpconfig.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,26 @@ extern const struct _mp_obj_module_t ustack_module;
460460
#define USTACK_MODULE
461461
#endif
462462

463+
// These modules are not yet in shared-bindings, but we prefer the non-uxxx names.
464+
#if MICROPY_PY_UERRNO
465+
#define ERRNO_MODULE
466+
{ MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) },
467+
#else
468+
#define ERRNO_MODULE
469+
#endif
470+
463471
#if MICROPY_PY_UJSON
464472
#define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) },
465473
#else
466474
#define JSON_MODULE
467475
#endif
468476

477+
#if MICROPY_PY_URE
478+
#define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) },
479+
#else
480+
#define RE_MODULE
481+
#endif
482+
469483
// Define certain native modules with weak links so they can be replaced with Python
470484
// implementations. This list may grow over time.
471485
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
@@ -495,6 +509,7 @@ extern const struct _mp_obj_module_t ustack_module;
495509
DIGITALIO_MODULE \
496510
TERMINALIO_MODULE \
497511
DISPLAYIO_MODULE \
512+
ERRNO_MODULE \
498513
GAMEPAD_MODULE \
499514
I2CSLAVE_MODULE \
500515
JSON_MODULE \
@@ -507,6 +522,7 @@ extern const struct _mp_obj_module_t ustack_module;
507522
PIXELBUF_MODULE \
508523
PULSEIO_MODULE \
509524
RANDOM_MODULE \
525+
RE_MODULE \
510526
RTC_MODULE \
511527
SAMD_MODULE \
512528
STAGE_MODULE \

py/objmodule.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
179179
// extmod modules
180180

181181
#if MICROPY_PY_UERRNO
182-
{ MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) },
183182
{ MP_ROM_QSTR(MP_QSTR_uerrno), MP_ROM_PTR(&mp_module_uerrno) },
184183
#endif
185184
#if MICROPY_PY_UCTYPES
@@ -189,11 +188,9 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
189188
{ MP_ROM_QSTR(MP_QSTR_uzlib), MP_ROM_PTR(&mp_module_uzlib) },
190189
#endif
191190
#if MICROPY_PY_UJSON
192-
{ MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) },
193191
{ MP_ROM_QSTR(MP_QSTR_ujson), MP_ROM_PTR(&mp_module_ujson) },
194192
#endif
195193
#if MICROPY_PY_URE
196-
{ MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) },
197194
{ MP_ROM_QSTR(MP_QSTR_ure), MP_ROM_PTR(&mp_module_ure) },
198195
#endif
199196
#if MICROPY_PY_UHEAPQ

0 commit comments

Comments
 (0)