From fdfc4421b112fe87e5098c61bba4ae65ccb5b162 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 20 Oct 2023 13:35:38 -0400 Subject: [PATCH] MICROPY_NONSTANDARD_TYPECODES default; check MICROPY_PY_ERRNO in objexcept.c --- py/mpconfig.h | 6 ++++++ py/objexcept.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/py/mpconfig.h b/py/mpconfig.h index 4bfbde2bcc..195eb5981a 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1424,6 +1424,12 @@ typedef double mp_float_t; #define MICROPY_PY_STRUCT (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_CORE_FEATURES) #endif +// CIRCUITPY-CHANGE +// Whether to provide non-standard typecodes in "struct" module +#ifndef MICROPY_NONSTANDARD_TYPECODES +#define MICROPY_NONSTANDARD_TYPECODES (1) +#endif + // Whether to provide "sys" module #ifndef MICROPY_PY_SYS #define MICROPY_PY_SYS (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_CORE_FEATURES) diff --git a/py/objexcept.c b/py/objexcept.c index ba3166a2ab..0f7dd06e3d 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -344,6 +344,7 @@ void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { } else if (attr == MP_QSTR_strerror) { if (self->args->len > 1) { dest[0] = self->args->items[1]; + #if MICROPY_PY_ERRNO } else if (self->args->len > 0) { char decompressed[50]; const char *msg = mp_common_errno_to_str(self->args->items[0], decompressed, sizeof(decompressed)); @@ -352,6 +353,7 @@ void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { } else { dest[0] = mp_const_none; } + #endif } else { dest[0] = mp_const_none; }