Skip to content

tools/mpremote: Support OSError's on targets without errno. #17551

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dpgeorge
Copy link
Member

Summary

Targets without the errno module enabled will not render OSErrors 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 the errno module disabled.

Targets without the `errno` module enabled will not render `OSError`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.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge added the tools Relates to tools/ directory in source, or other tooling label Jun 23, 2025
Copy link

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

Copy link

codecov bot commented Jun 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.56%. Comparing base (35f15cf) to head (16c0265).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #17551   +/-   ##
=======================================
  Coverage   98.56%   98.56%           
=======================================
  Files         169      169           
  Lines       21950    21950           
=======================================
  Hits        21636    21636           
  Misses        314      314           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Relates to tools/ directory in source, or other tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant