-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
[ESP32] Errno mismatch between esp-idf and mpy #5752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The main reason is for consistency with other (bare-metal) ports. So if you get an OSError with just a numeric value for the errno then that numeric value matches other ports and the value itself can be looked up in Also, some tests check for specific errno values because the symbol does not exist in the standard
That could be fixed by converting newlib's 115 to uPy's "standard" number. Really there should be a table doing the mapping that can be use everywhere to convert IDF errno to uPy errno. It's just that this wasn't done yet.
I'm not sure what you mean by "not defined in MP's list". In
Even with |
I understand your point of view. Let me try to argue for a different point of view:
You are correct. I got slightly mixed-up, what I meant to say is that it's not defined in moduerrno.c and thus when printing the exception one just sees "23" and has to start looking at sources to figure out what it is.
You mean: look in mperrno.h and if not found look in esp-idf newlib's errno.h and if you want to be really sure grep the esp32's sources just in case two errors get mapped to the same number. ;-) |
Are these additional error codes ever raised as an OSError? For mbedtls (ussl module) I don't think they are.
But the error messages for standard errno's should match other ports, eg:
For extended errno's that are IDF specific, how would the corresponding error message look?
As far as I know there are no uses of hard-coded errno's in the C code. Only in the Python tests, eg In the end it's not a problem to disable |
I also realized that for native modules it can be awkward if one wants to use EXXX symbols: which .h file do you include and what if you want to test against an esp-idf EXXX and raise an MPY EYYY... Overall it's clearly not something that prevents getting work done, but clean it is not. Thanks for responding to my questions! |
See this comment for additional reasoning: #6569 (comment) |
make github-ci install python version "3.x" everywhere we use actions/setup-python (and upgrade to setup-python@v2)
The esp32 port sets
MICROPY_USE_INTERNAL_ERRNO
which causes the built-in list of error codes inpy/mperrno.h
to be used. That's mostly OK, but there are discrepancies WRT esp-idf (see newlib'serrno.h
) and lots of missing error codes as a result. Examples:EINPROGRESS
while esp-idf uses 119, this particular one is patched up inexception_from_errno
in https://github.com/micropython/micropython/blob/master/ports/esp32/modsocket.c#L156, however esp-idf uses 115 forENETDOWN
, which is now essentially undetectableENFILE /* Too many open files in system */
(happens, for example, if one doesn't close sockets on error somewhere).Q: is there a reason the esp32 port sets the insufficient
MICROPY_USE_INTERNAL_ERRNO
other than expediency at the time?The text was updated successfully, but these errors were encountered: