Skip to content

Update stdlib/gzip stdlib/zlib to positional only parameters - #1184

Open
Josverl wants to merge 2 commits into
micropython:masterfrom
Josverl:stdlib/gzip_stdlib
Open

Josverl wants to merge 2 commits into
micropython:masterfrom
Josverl:stdlib/gzip_stdlib

Conversation

@Josverl

@Josverl Josverl commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The documentation of gzip and zlib specifies positional only parameters.
This PR aligns the implementation to the documentation as suggested in
micropython/micropython#19893 (comment)

Testing

  • Verified function signatures on a custom Pico2 firmware build
  • Added tests as part of this PR

Trade-offs and Alternatives

As the current MicroPython runtime allowed to use named params, even though the documentation did specify otherwise, there will be existing code that uses named parameters.
This code will need to identified, and adjusted to use positional only before merging this

Github search

In the MicroPython repo itself (incomplete list):

Generative AI

I used generative AI tools when creating this PR, but a human has checked the
code and is responsible for the code and the description above.

Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
@dpgeorge

dpgeorge commented Dec 1, 2026

Copy link
Copy Markdown
Member

In the MicroPython repo itself (incomplete list):

* [/ports/stm32/mboot/mboot_pack_dfu.py](https://github.com/micropython/micropython/blob/cbe3d6ae2c8c90a0860d271d1f2eb5a8caf2e958/ports/stm32/mboot/mboot_pack_dfu.py#L247)

* [tools/mpremote/mpremote/commands.py](https://github.com/micropython/micropython/blob/037f2dad72a7d11d461330873b50bb9ccf4fed69/tools/mpremote/mpremote/commands.py#L626)

Both of those Python files will only run under CPython (the first requires pyhy, the second pyserial). So we don't need to worry about them wrt positional-only parameters.

That said, I agree that wbits should stay keyword.

Comment thread python-stdlib/zlib/zlib.py Resolved
Comment thread python-stdlib/zlib/zlib.py Resolved
Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
@Josverl
Josverl force-pushed the stdlib/gzip_stdlib branch from 78ba1ac to 2955b9f Compare December 1, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants