classification
Title: shutil._make_zipfile possible resource leak
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: peter@psantoro.net, python-dev
Priority: normal Keywords: patch

Created on 2014-01-01 11:21 by peter@psantoro.net, last changed 2014-02-02 20:31 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
shutil.diff peter@psantoro.net, 2014-01-01 11:21 patch
Messages (2)
msg207132 - (view) Author: Peter Santoro (peter@psantoro.net) * Date: 2014-01-01 11:21
Now that zipfile.ZipFile supports the context manager protocol, shouldn't
shutil._make_zipfile make use of it to avoid the possibility of the archive file not being closed properly if an exception occurs?  It should be noted that shutil._unpack_zipfile does use try/finally to ensure that files are closed.
msg210009 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-02-02 20:31
New changeset 767d034b3feb by Benjamin Peterson in branch '2.7':
use with statement to ensure zipfile is always closed (closes #20102)
http://hg.python.org/cpython/rev/767d034b3feb

New changeset 838674d15b5b by Benjamin Peterson in branch '3.3':
use with statement to ensure zipfile is always closed (closes #20102)
http://hg.python.org/cpython/rev/838674d15b5b

New changeset 20aa07f93ca7 by Benjamin Peterson in branch 'default':
merge 3.3 (#20102)
http://hg.python.org/cpython/rev/20aa07f93ca7
History
Date User Action Args
2014-02-02 20:31:24python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg210009

resolution: fixed
stage: resolved
2014-01-01 11:21:17peter@psantoro.netcreate