tools/mpremote: Support OSError's on targets without errno. #17551
+5
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Targets without the
errno
module enabled will not renderOSError
s with the name of the error. Instead they just print the numeric error code.Add support for such targets by explicitly recognising certain error codes.
Testing
Tested on SEEED_XIAO_SAMD21: prior to this fix doing an
mpremote mip install
would crash with an exception. Now it works.Trade-offs and Alternatives
This hard codes the errno values based on
py/mperrno.h
, but I don't think there's any other option. This is anyway what most bare-metal ports use, especially if they are minimal and have theerrno
module disabled.