[Python-checkins] cpython (merge 3.2 -> default): Issue #15800: fix the closing of input / output files when gzip is used as a

antoine.pitrou python-checkins at python.org
Thu Aug 30 00:33:58 CEST 2012


http://hg.python.org/cpython/rev/be505d22dde8
changeset:   78806:be505d22dde8
parent:      78804:4a37bed5b96f
parent:      78805:0b5ba5f610a9
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Thu Aug 30 00:30:14 2012 +0200
summary:
  Issue #15800: fix the closing of input / output files when gzip is used as a script.

files:
  Lib/gzip.py |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Lib/gzip.py b/Lib/gzip.py
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -670,9 +670,9 @@
             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__':

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list