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 <[email protected]>
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

+3-3
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

+1-1
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)