mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
start banging on zipfile's file leakiness
This commit is contained in:
parent
d6868b4ed4
commit
d285bdb443
2 changed files with 50 additions and 10 deletions
|
@ -874,7 +874,8 @@ class ZipFile:
|
|||
|
||||
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'."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue