]> granicus.if.org Git - python/commitdiff
Buglet: restore functioning of gzip as an executable when (de)compressing from stdin...
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 4 Jan 2009 21:11:10 +0000 (21:11 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 4 Jan 2009 21:11:10 +0000 (21:11 +0000)
Lib/gzip.py

index 9d8dac5bdbc9465037a2e95da00d28c9f151f883..11d557172fd0de800d9cd37030cfb33bd71f3293 100644 (file)
@@ -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")