Skip to content

Conversation

dpgeorge
Copy link
Member

Summary

Because the wbits parameter was only added to zlib.compress in CPython 3.11. Using zlib.compressobj makes the code compatible with much older CPython versions.

Fixes issue #17140.

Testing

Tested on PYBD_SF2, using mpremote romfs deploy. It works with CPython 3.13, and should with earlier versions (although I didn't test earlier versions).

@dpgeorge dpgeorge added the tools Relates to tools/ directory in source, or other tooling label Apr 17, 2025
@dpgeorge dpgeorge linked an issue Apr 17, 2025 that may be closed by this pull request
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.54%. Comparing base (584fa88) to head (dcca3ff).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #17143   +/-   ##
=======================================
  Coverage   98.54%   98.54%           
=======================================
  Files         169      169           
  Lines       21890    21890           
=======================================
  Hits        21572    21572           
  Misses        318      318           

☔ 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:    +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

@dpgeorge dpgeorge requested a review from projectgus April 24, 2025 05:01
Because the `wbits` parameter was only added to `zlib.compress` in
CPython 3.11.  Using `zlib.compressobj` makes the code compatible with much
older CPython versions.

Fixes issue micropython#17140.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge force-pushed the tools-mpremote-zlib-compressobj branch from ef02669 to dcca3ff Compare April 24, 2025 12:33
@dpgeorge dpgeorge merged commit dcca3ff into micropython:master Apr 24, 2025
66 checks passed
@dpgeorge dpgeorge deleted the tools-mpremote-zlib-compressobj branch April 24, 2025 12:44
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.

mpremote romfs deploy throws exception
2 participants