8000 py/mpconfig: Enable 2-argument built-in next() at basic feature level. by dpgeorge · Pull Request #16902 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

Conversation

dpgeorge
Copy link
Member

Summary

Enable the 2-argument form of the built-in next() function at the basic feature level (which is one above core features).

This is a pretty fundamental built-in and having CPython-compatible behaviour is beneficial. The code size increase is not much, and ports/boards can still disable it if needed to save space.

Addresses issue #5384.

Testing

CI should test this.

Trade-offs and Alternatives

Could leave it disabled and document better the differences. But I think it's worth the increase in code size, most big boards have enough space.

@dpgeorge dpgeorge added the py-core Relates to py/ directory in source label Mar 11, 2025
Copy link
codecov bot commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.54%. Comparing base (35d4d2d) to head (994751c).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #16902   +/-   ##
=======================================
  Coverage   98.54%   98.54%           
=======================================
  Files         169      169           
  Lines       21877    21877           
=======================================
  Hits        21558    21558           
  Misses        319      319           

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

Copy link

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:   +72 +0.008% standard[incl +32(data)]
      stm32:   +20 +0.005% PYBV10
     mimxrt:   +24 +0.007% TEENSY40
        rp2:   +24 +0.003% RPI_PICO_W
       samd:   +20 +0.007% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:   +28 +0.006% VIRT_RV32

@projectgus
Copy link
Contributor

Change LGTM but we should probably update or remove tests/cpydiff/builtin_next_arg2.py at the same time. (I'm not sure what the approach is for CPython differences that only exist at certain feature levels?)

@dpgeorge dpgeorge force-pushed the py-mpconfig-next2-at-basic-feature-level branch from a3fd78e to 48a87f7 Compare March 17, 2025 23:59
@dpgeorge
Copy link
Member Author

should probably update or remove tests/cpydiff/builtin_next_arg2.py at the same time

Good idea, now removed.

I think in general the policy is that we only document differences that are different no matter what the configuration level.

This is a pretty fundamental built-in and having CPython-compatible
behaviour is beneficial.  The code size increase is not much, and
ports/boards can still disable it if needed to save space.

Addresses issue micropython#5384.

Signed-off-by: Damien George <damien@micropython.org>
Because 2-arg `next()` is implemented, and now enabled at the basic feature
level.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge force-pushed the py-mpconfig-next2-at-basic-feature-level branch from 48a87f7 to 994751c Compare March 27, 2025 00:52
@dpgeorge dpgeorge merged commit 994751c into micropython:master Mar 27, 2025
62 checks passed
@dpgeorge dpgeorge deleted the py-mpconfig-next2-at-basic-feature-level branch March 27, 2025 00:53
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.

2 participants
0