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