mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Buglet: restore functioning of gzip as an executable when (de)compressing from stdin to stdout
This commit is contained in:
parent
d6d63f5437
commit
9d625c26c0
1 changed files with 4 additions and 4 deletions
|
@ -473,8 +473,8 @@ def _test():
|
|||
for arg in args:
|
||||
if decompress:
|
||||
if arg == "-":
|
||||
f = GzipFile(filename="", mode="rb", fileobj=sys.stdin)
|
||||
g = sys.stdout
|
||||
f = GzipFile(filename="", mode="rb", fileobj=sys.stdin.buffer)
|
||||
g = sys.stdout.buffer
|
||||
else:
|
||||
if arg[-3:] != ".gz":
|
||||
print("filename doesn't end in .gz:", repr(arg))
|
||||
|
@ -483,8 +483,8 @@ def _test():
|
|||
g = builtins.open(arg[:-3], "wb")
|
||||
else:
|
||||
if arg == "-":
|
||||
f = sys.stdin
|
||||
g = GzipFile(filename="", mode="wb", fileobj=sys.stdout)
|
||||
f = sys.stdin.buffer
|
||||
g = GzipFile(filename="", mode="wb", fileobj=sys.stdout.buffer)
|
||||
else:
|
||||
f = builtins.open(arg, "rb")
|
||||
g = open(arg + ".gz", "wb")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue