Skip to content

Commit ffb07db

Browse files
committed
gzip: Fix recursion error in open() function.
And give the `mode` parameter a default, matching CPython. Signed-off-by: Damien George <damien@micropython.org>
1 parent 2242465 commit ffb07db

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

python-stdlib/gzip/gzip.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
_WBITS = const(15)
55

6-
import io, deflate
6+
import builtins, io, deflate
77

88

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

1212

13-
def open(filename, mode):
14-
return deflate.DeflateIO(open(filename, mode), deflate.GZIP, _WBITS, True)
13+
def open(filename, mode="rb"):
14+
return deflate.DeflateIO(builtins.open(filename, mode), deflate.GZIP, _WBITS, True)
1515

1616

1717
if hasattr(deflate.DeflateIO, "write"):

python-stdlib/gzip/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
metadata(version="1.0.0")
1+
metadata(version="1.0.1")
22

33
module("gzip.py")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy