Skip to content

Conversation

@jepler
Copy link
Contributor

@jepler jepler commented Sep 20, 2025

Summary

For m68k-micropython I'm interested in REPR_B. However, CI doesn't check any REPR_B builds, so of course there were test failures.

This patch series adds a 32-bit REPR_B build (i686 Linux) and fixes the test failures that arose.

This is an alternative to the original #17688 that doesn't make an incompatible change to the uctypes constants, which turn out to need to be stable.

It punts on several limitations, filed as issues:

Testing

This adds a new build and associated tests to CI.

Trade-offs and Alternatives

While it was the uctypes problem that made me look into this in the first place, it turns out to be hard to fix; I'll probably just carry the incompatible fix (modifying the uctypes constant values) in m68k-micropython.

tools/ci.sh Outdated
(-h|-?|--help)
_ci_help
;;
(--jeff)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jeff gets own special option. 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha that wasn't supposed to be there. 🤣

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've been working very hard lately. I think you deserve it.

@github-actions
Copy link

github-actions bot commented Sep 20, 2025

Code size report:

  mpy-cross:    +0 +0.000% 
   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

@jepler jepler force-pushed the test-repr-b-nouctypes branch from b40a526 to 2d86f52 Compare September 20, 2025 17:09
@codecov
Copy link

codecov bot commented Sep 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.38%. Comparing base (adf6319) to head (9e09eb1).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #18109   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         171      171           
  Lines       22287    22288    +1     
=======================================
+ Hits        21928    21929    +1     
  Misses        359      359           

☔ 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.

@jepler jepler force-pushed the test-repr-b-nouctypes branch from 2d86f52 to 4e1408b Compare September 20, 2025 18:55
try:
k = k + 1
except MemoryError:
print("SKIP")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of SKIP'ing and essentially duplicating this test below for REPR_B, how about using this bit of code here as a feature detection for the integer values to iterate over.

Eg:

limit_value = 1 << 29
micropython.heap_lock()
try:
    k = limit_value + 1
except MemoryError:
    # REPR B, use a smaller limit value
    limit_value = 1 << 28
micropython.heap_unlock()

for d in (0, 27, limit_value, -1861, -limit_value):
    ...

Oh... I guess that makes the .exp file different... which is probably too difficult to work around. In that case I guess it's OK to have separate test files.

@dpgeorge dpgeorge added the py-core Relates to py/ directory in source label Sep 22, 2025
@jepler jepler force-pushed the test-repr-b-nouctypes branch 2 times, most recently from abffd43 to 62381ff Compare September 28, 2025 01:22
jepler and others added 6 commits September 27, 2025 20:25
Different results are needed for different integer sizes.

Signed-off-by: Jeff Epler <[email protected]>
The check for 'fits in a small int' is specific to the 31-bit
int of other OBJ_REPRs.

Signed-off-by: Jeff Epler <[email protected]>
This showed up some interesting errors (hopefully all fixed now).

Signed-off-by: Jeff Epler <[email protected]>
@jepler jepler force-pushed the test-repr-b-nouctypes branch from 62381ff to 9e09eb1 Compare September 28, 2025 01:25
Copy link
Member

@dpgeorge dpgeorge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good now, a nice clean set of changes. Thanks!

@dpgeorge
Copy link
Member

Rebased and merged in 2d08f2f through e3ef682

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

py-core Relates to py/ directory in source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants