summaryrefslogtreecommitdiff
path: root/stmhal/uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/uart.c')
-rw-r--r--stmhal/uart.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/stmhal/uart.c b/stmhal/uart.c
index 85feb32e0..177318aec 100644
--- a/stmhal/uart.c
+++ b/stmhal/uart.c
@@ -772,9 +772,9 @@ STATIC mp_uint_t pyb_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, i
// wait for first char to become available
if (!uart_rx_wait(self, self->timeout)) {
- // we can either return 0 to indicate EOF (then read() method returns b'')
- // or return EAGAIN error to indicate non-blocking (then read() method returns None)
- return 0;
+ // return EAGAIN error to indicate non-blocking (then read() method returns None)
+ *errcode = EAGAIN;
+ return MP_STREAM_ERROR;
}
// read the data