MICROPY_NONSTANDARD_TYPECODES default; check MICROPY_PY_ERRNO in objexcept.c

This commit is contained in:
Dan Halbert 2023-10-20 13:35:38 -04:00
parent 009b3ae86b
commit fdfc4421b1
2 changed files with 8 additions and 0 deletions

View File

@ -1424,6 +1424,12 @@ typedef double mp_float_t;
#define MICROPY_PY_STRUCT (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_CORE_FEATURES) #define MICROPY_PY_STRUCT (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_CORE_FEATURES)
#endif #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 // Whether to provide "sys" module
#ifndef MICROPY_PY_SYS #ifndef MICROPY_PY_SYS
#define MICROPY_PY_SYS (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_CORE_FEATURES) #define MICROPY_PY_SYS (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_CORE_FEATURES)

View File

@ -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) { } else if (attr == MP_QSTR_strerror) {
if (self->args->len > 1) { if (self->args->len > 1) {
dest[0] = self->args->items[1]; dest[0] = self->args->items[1];
#if MICROPY_PY_ERRNO
} else if (self->args->len > 0) { } else if (self->args->len > 0) {
char decompressed[50]; char decompressed[50];
const char *msg = mp_common_errno_to_str(self->args->items[0], decompressed, sizeof(decompressed)); 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 { } else {
dest[0] = mp_const_none; dest[0] = mp_const_none;
} }
#endif
} else { } else {
dest[0] = mp_const_none; dest[0] = mp_const_none;
} }