classification
Title: zipfile.ZipExtFile is a context manager, but that is not documented
Type: resource usage Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brian.curtin Nosy List: brian.curtin, ezio.melotti, python-dev, sandberg
Priority: normal Keywords: patch

Created on 2010-06-03 11:39 by sandberg, last changed 2016-05-13 18:20 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
with-ZipExtFile-in-test.patch sandberg, 2010-06-03 12:32
Messages (6)
msg106941 - (view) Author: Erik Carstensen (sandberg) Date: 2010-06-03 11:39
It's nice that ZipFile is a context manager in 2.7.  It would be nice and more consistent if the objects returned from ZipFile.open() were context managers too.
msg106945 - (view) Author: Erik Carstensen (sandberg) Date: 2010-06-03 12:10
Sorry, my mistake, ZipExtFile is indeed a context manager: I ran into the problem in 2.6, and checked whether it was fixed in 2.7; when quickly reading zipfile.py I saw that only ZipFile had context manager methods, I missed the BufferedIOBase inheritance. And when reading the tests I didn't see any 'with ZipFile.open(x) as y' expression.

Maybe it still makes sense to document and test this. Changing the title.
msg106946 - (view) Author: Erik Carstensen (sandberg) Date: 2010-06-03 12:32
Patch that makes the zipfile test consistently use with statements to handle the return value of ZipFile.open().
msg121421 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-11-18 02:20
Fixed in r86506 for py3k. The maintenance branches recently had an RC in preparation for a release -- I'll backport once they go out.
msg134119 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-04-20 02:16
New changeset 83a426e969f5 by Brian Curtin in branch '2.7':
Fix #8886. Use context managers throughout zipfile tests.
http://hg.python.org/cpython/rev/83a426e969f5
msg265483 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-13 18:20
New changeset ae50bf6e3ac8 by Serhiy Storchaka in branch '3.5':
Restored test_interleaved. After issue #8886 it was a duplicate of
https://hg.python.org/cpython/rev/ae50bf6e3ac8

New changeset 62d844d2bd07 by Serhiy Storchaka in branch 'default':
Restored test_interleaved. After issue #8886 it was a duplicate of
https://hg.python.org/cpython/rev/62d844d2bd07

New changeset ba823131b25e by Serhiy Storchaka in branch '2.7':
Restored test_interleaved. After issue #8886 it was a duplicate of
https://hg.python.org/cpython/rev/ba823131b25e
History
Date User Action Args
2016-05-13 18:20:11python-devsetmessages: + msg265483
2011-04-20 02:16:58brian.curtinsetstatus: open -> closed
stage: patch review -> resolved
resolution: accepted -> fixed
versions: - Python 3.1
2011-04-20 02:16:02python-devsetnosy: + python-dev
messages: + msg134119
2010-11-18 02:20:59brian.curtinsetassignee: brian.curtin
type: enhancement -> resource usage
versions: + Python 3.1, Python 3.2, - Python 3.3
nosy: + brian.curtin

messages: + msg121421
resolution: accepted
2010-11-03 22:42:01ezio.melottisetnosy: + ezio.melotti

stage: patch review
2010-06-03 12:32:58sandbergsetfiles: + with-ZipExtFile-in-test.patch
keywords: + patch
messages: + msg106946
2010-06-03 12:10:17sandbergsetmessages: + msg106945
title: zipfile.ZipExtFile should be a context manager -> zipfile.ZipExtFile is a context manager, but that is not documented
2010-06-03 11:39:26sandbergcreate