Skip to content

Commit

Permalink
gzip: Fix recursion error in open() function.
Browse files Browse the repository at this point in the history
And give the `mode` parameter a default, matching CPython.

Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Feb 29, 2024
1 parent 2242465 commit ffb07db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions python-stdlib/gzip/gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

_WBITS = const(15)

import io, deflate
import builtins, io, deflate


def GzipFile(fileobj):
return deflate.DeflateIO(fileobj, deflate.GZIP, _WBITS)


def open(filename, mode):
return deflate.DeflateIO(open(filename, mode), deflate.GZIP, _WBITS, True)
def open(filename, mode="rb"):
return deflate.DeflateIO(builtins.open(filename, mode), deflate.GZIP, _WBITS, True)


if hasattr(deflate.DeflateIO, "write"):
Expand Down
2 changes: 1 addition & 1 deletion python-stdlib/gzip/manifest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
metadata(version="1.0.0")
metadata(version="1.0.1")

module("gzip.py")

0 comments on commit ffb07db

Please sign in to comment.