Issue #15800: fix the closing of input / output files when gzip is used as a script.
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 29 Aug 2012 22:29:24 +0000 (00:29 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 29 Aug 2012 22:29:24 +0000 (00:29 +0200)
Lib/gzip.py

index ee45e50ffbae3fc8f0b3bd56f662cd6467696352..e1b43a55988a5a952521c199860330647ec8addc 100644 (file)
@@ -621,9 +621,9 @@ def _test():
             if not chunk:
                 break
             g.write(chunk)
-        if g is not sys.stdout:
+        if g is not sys.stdout.buffer:
             g.close()
-        if f is not sys.stdin:
+        if f is not sys.stdin.buffer:
             f.close()
 
 if __name__ == '__main__':