kopia lustrzana https://github.com/micropython/micropython-lib
gzip: Fix recursion error in open() function.
And give the `mode` parameter a default, matching CPython. Signed-off-by: Damien George <damien@micropython.org>pull/813/head
rodzic
224246531e
commit
ffb07dbce5
|
@ -3,15 +3,15 @@
|
||||||
|
|
||||||
_WBITS = const(15)
|
_WBITS = const(15)
|
||||||
|
|
||||||
import io, deflate
|
import builtins, io, deflate
|
||||||
|
|
||||||
|
|
||||||
def GzipFile(fileobj):
|
def GzipFile(fileobj):
|
||||||
return deflate.DeflateIO(fileobj, deflate.GZIP, _WBITS)
|
return deflate.DeflateIO(fileobj, deflate.GZIP, _WBITS)
|
||||||
|
|
||||||
|
|
||||||
def open(filename, mode):
|
def open(filename, mode="rb"):
|
||||||
return deflate.DeflateIO(open(filename, mode), deflate.GZIP, _WBITS, True)
|
return deflate.DeflateIO(builtins.open(filename, mode), deflate.GZIP, _WBITS, True)
|
||||||
|
|
||||||
|
|
||||||
if hasattr(deflate.DeflateIO, "write"):
|
if hasattr(deflate.DeflateIO, "write"):
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
metadata(version="1.0.0")
|
metadata(version="1.0.1")
|
||||||
|
|
||||||
module("gzip.py")
|
module("gzip.py")
|
||||||
|
|
Ładowanie…
Reference in New Issue