From 902da05a180d40e62373656f8be94a01ca39eb94 Mon Sep 17 00:00:00 2001 From: Thorsten von Eicken Date: Wed, 11 Nov 2020 17:46:18 -0800 Subject: [PATCH] esp32: Set MICROPY_USE_INTERNAL_ERRNO=0 to use toolchain's errno.h. The underlying OS (the ESP-IDF) uses it's own internal errno codes and so it's simpler and cleaner to use those rather than trying to convert everything to the values defined in py/mperrno.h. --- ports/esp32/mpconfigport.h | 2 +- tests/net_hosted/connect_nonblock.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index 7b0a00250b..392f8c749c 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -51,7 +51,7 @@ #define MICROPY_MODULE_FROZEN_MPY (1) #define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool #define MICROPY_CAN_OVERRIDE_BUILTINS (1) -#define MICROPY_USE_INTERNAL_ERRNO (1) +#define MICROPY_USE_INTERNAL_ERRNO (0) // errno.h from xtensa-esp32-elf/sys-include/sys #define MICROPY_USE_INTERNAL_PRINTF (0) // ESP32 SDK requires its own printf #define MICROPY_ENABLE_SCHEDULER (1) #define MICROPY_SCHEDULER_DEPTH (8) diff --git a/tests/net_hosted/connect_nonblock.py b/tests/net_hosted/connect_nonblock.py index 3a3eaa2ba0..c024b65a0a 100644 --- a/tests/net_hosted/connect_nonblock.py +++ b/tests/net_hosted/connect_nonblock.py @@ -2,8 +2,9 @@ try: import usocket as socket + import uerrno as errno except: - import socket + import socket, errno def test(peer_addr): @@ -12,7 +13,7 @@ def test(peer_addr): try: s.connect(peer_addr) except OSError as er: - print(er.args[0] == 115) # 115 is EINPROGRESS + print(er.args[0] == errno.EINPROGRESS) s.close()