diff options
| author | Sabas <sabasjimenez@gmail.com> | 2020-04-09 17:05:11 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-09 17:05:11 -0500 |
| commit | cac4fb0318015f344e191e3077e99ffdce347515 (patch) | |
| tree | d96c5d7010563f9db3f4e5fb2f981e5bb75c6345 /py/objmodule.c | |
| parent | 2a47623283911c8ebac6152560affc8c419dbddf (diff) | |
| parent | b3b8b5ca71dc58415083180d04b407185514c216 (diff) | |
Merge branch 'master' into nfc_copy
Diffstat (limited to 'py/objmodule.c')
| -rw-r--r-- | py/objmodule.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/py/objmodule.c b/py/objmodule.c index 627ba79e8..b6a8a084e 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -69,6 +69,13 @@ STATIC void module_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { // delete/store attribute mp_obj_dict_t *dict = self->globals; if (dict->map.is_fixed) { + mp_map_elem_t *elem = mp_map_lookup(&dict->map, MP_OBJ_NEW_QSTR(attr), MP_MAP_LOOKUP); + // Return success if the given value is already in the dictionary. This is the case for + // native packages with native submodules. + if (elem != NULL && elem->value == dest[1]) { + dest[0] = MP_OBJ_NULL; // indicate success + return; + } else #if MICROPY_CAN_OVERRIDE_BUILTINS if (dict == &mp_module_builtins_globals) { if (MP_STATE_VM(mp_module_builtins_override_dict) == NULL) { @@ -206,6 +213,14 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = { { MP_ROM_QSTR(MP_QSTR_ujson), MP_ROM_PTR(&mp_module_ujson) }, #endif #endif +#if CIRCUITPY_ULAB +#if CIRCUITPY +// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here. +// TODO: move to shared-bindings/ +#else + { MP_ROM_QSTR(MP_QSTR_ulab), MP_ROM_PTR(&ulab_user_cmodule) }, +#endif +#endif #if MICROPY_PY_URE #if CIRCUITPY // CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here. |
