Skip to content

Commit 30b86a5

Browse files
committed
codal_port: Enable uerrno module to get nicer OSError exceptions.
If known, the symbolic name of the OSError is now printed as part of the exception message. Signed-off-by: Damien George <[email protected]>
1 parent d6c01d0 commit 30b86a5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/codal_port/microbit_uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ STATIC mp_uint_t microbit_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t si
144144

145145
// check there is at least 1 char available
146146
if (!mp_hal_stdio_poll(MP_STREAM_POLL_RD)) {
147-
*errcode = EAGAIN;
147+
*errcode = MP_EAGAIN;
148148
return MP_STREAM_ERROR;
149149
}
150150

src/codal_port/mpconfigport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#define MICROPY_MODULE_WEAK_LINKS (1)
6262
#define MICROPY_MODULE_FROZEN_MPY (1)
6363
#define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool
64+
#define MICROPY_USE_INTERNAL_ERRNO (1)
6465
#define MICROPY_ENABLE_SCHEDULER (1)
6566

6667
// Fine control over Python builtins, classes, modules, etc
@@ -77,6 +78,7 @@
7778
#define MICROPY_PY_SYS_PLATFORM "microbit"
7879

7980
// Extended modules
81+
#define MICROPY_PY_UERRNO (1)
8082
#define MICROPY_PY_UTIME_MP_HAL (1)
8183
#define MICROPY_PY_URANDOM (1)
8284
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)

0 commit comments

Comments
 (0)