summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorjgillick <j_gillick@yahoo.com>2020-11-22 01:07:03 -0800
committerjgillick <j_gillick@yahoo.com>2020-11-22 01:07:03 -0800
commit63b0bf9075178984276d33bbf0282b24dce33997 (patch)
treef23afdc09c957751357170647661ee68fcf8d4b9 /py
parent5f0a372a2206c14e4ae206ec7cb879265aa7a38a (diff)
parent2f146090444492c344a0260faa151660f5ec3c7a (diff)
Merge remote-tracking branch 'origin/main' into thunderpack1.2
Diffstat (limited to 'py')
-rw-r--r--py/circuitpy_mpconfig.h12
-rw-r--r--py/mkenv.mk2
-rw-r--r--py/obj.c1
-rw-r--r--py/objmodule.c7
4 files changed, 20 insertions, 2 deletions
diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h
index 1e01bd9c5..85e152670 100644
--- a/py/circuitpy_mpconfig.h
+++ b/py/circuitpy_mpconfig.h
@@ -186,7 +186,7 @@ typedef long mp_off_t;
#define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_FULL_BUILD)
#define MICROPY_COMP_FSTRING_LITERAL (MICROPY_CPYTHON_COMPAT)
-#define MICROPY_MODULE_WEAK_LINKS (CIRCUITPY_FULL_BUILD)
+#define MICROPY_MODULE_WEAK_LINKS (0)
#define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_COMPLEX (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_FROZENSET (CIRCUITPY_FULL_BUILD)
@@ -197,6 +197,9 @@ typedef long mp_off_t;
#ifndef MICROPY_PY_COLLECTIONS_ORDEREDDICT
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (CIRCUITPY_FULL_BUILD)
#endif
+#ifndef MICROPY_PY_UBINASCII
+#define MICROPY_PY_UBINASCII (CIRCUITPY_FULL_BUILD)
+#endif
// Opposite setting is deliberate.
#define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_FULL_BUILD)
#ifndef MICROPY_PY_URE
@@ -699,6 +702,12 @@ extern const struct _mp_obj_module_t ustack_module;
#endif
// These modules are not yet in shared-bindings, but we prefer the non-uxxx names.
+#if MICROPY_PY_UBINASCII
+#define BINASCII_MODULE { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) },
+#else
+#define BINASCII_MODULE
+#endif
+
#if MICROPY_PY_UERRNO
#define ERRNO_MODULE { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) },
#else
@@ -770,6 +779,7 @@ extern const struct _mp_obj_module_t wifi_module;
AUDIOMIXER_MODULE \
AUDIOMP3_MODULE \
AUDIOPWMIO_MODULE \
+ BINASCII_MODULE \
BITBANGIO_MODULE \
BLEIO_MODULE \
BOARD_MODULE \
diff --git a/py/mkenv.mk b/py/mkenv.mk
index b76dd60f8..cb678e8e7 100644
--- a/py/mkenv.mk
+++ b/py/mkenv.mk
@@ -55,6 +55,8 @@ PYTHON3 ?= python3
RM = rm
RSYNC = rsync
SED = sed
+# Linux has 'nproc', macOS has 'sysctl -n hw.logicalcpu', this is cross-platform
+NPROC = $(PYTHON) -c 'import multiprocessing as mp; print(mp.cpu_count())'
AS = $(CROSS_COMPILE)as
CC = $(CROSS_COMPILE)gcc
diff --git a/py/obj.c b/py/obj.c
index 9dc0cf474..315e816e0 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -125,6 +125,7 @@ void mp_obj_print_exception(const mp_print_t *print, mp_obj_t exc) {
mp_printf(print, decompressed_block, block);
}
}
+ mp_obj_exception_clear_traceback(exc);
}
}
mp_obj_print_helper(print, exc, PRINT_EXC);
diff --git a/py/objmodule.c b/py/objmodule.c
index 757aece04..90796c535 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -239,7 +239,12 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
{ MP_ROM_QSTR(MP_QSTR_hashlib), MP_ROM_PTR(&mp_module_uhashlib) },
#endif
#if MICROPY_PY_UBINASCII
- { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) },
+#if CIRCUITPY
+// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here.
+// TODO: move to shared-bindings/
+#else
+ { MP_ROM_QSTR(MP_QSTR_ubinascii), MP_ROM_PTR(&mp_module_ubinascii) },
+#endif
#endif
#if MICROPY_PY_URANDOM
{ MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mp_module_urandom) },