commit | d285bdb4434a57126f7f17dc6b8f78204c180c1f | [log] [tgz] |
---|---|---|
author | Benjamin Peterson <benjamin@python.org> | Sun Oct 31 17:57:22 2010 +0000 |
committer | Benjamin Peterson <benjamin@python.org> | Sun Oct 31 17:57:22 2010 +0000 |
tree | 00790aae4b9fbe0f54af017ac415cce34eea97ef | |
parent | d6868b4ed45617675151d5abda7acf0080df8ca5 [diff] [blame] |
start banging on zipfile's file leakiness
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index a51dd21..184f4d2 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py
@@ -874,7 +874,8 @@ def read(self, name, pwd=None): """Return file bytes (as a string) for name.""" - return self.open(name, "r", pwd).read() + with self.open(name, "r", pwd) as fp: + return fp.read() def open(self, name, mode="r", pwd=None): """Return file-like object for 'name'."""