Roundup Robot added the comment:
New changeset b6fdf8c7a74d by Berker Peksag in branch '3.4':
Issue #22154: Add an example to show context management protocol support of
ZipFile.open().
https://hg.python.org/cpython/rev/b6fdf8c7a74d
New changeset 390a2f4dfd4a by Berker Peksag in branch
Berker Peksag added the comment:
Thanks for the patch, Mike.
--
nosy: +berker.peksag
resolution: - fixed
stage: needs patch - resolved
status: open - closed
type: behavior - enhancement
versions: +Python 3.4
___
Python tracker rep...@bugs.python.org
Tuomas Suutari added the comment:
The context manager support was added on issue #5511, so the documentation
should go to 2.7, 3.4 and default. Also the version added notes should be added.
--
nosy: +Tuomas Suutari
___
Python tracker
Mike Short added the comment:
Context manager comment code snippet added to zipfile doc - patch attached.
--
keywords: +patch
nosy: +Mike.Short
Added file: http://bugs.python.org/file36521/zipfile.patch
___
Python tracker rep...@bugs.python.org
New submission from Ralph Broenink:
In Python 3.2, context manager support for ZipFile was added. However, I would
also love the ability for ``ZipFile.open`` to be used as a context manager,
e.g.:
from zipfile import ZipFile
with ZipFile(test.zip, r) as z:
with
Serhiy Storchaka added the comment:
This is already implemented.
with ZipFile(Lib/test/zip_cp437_header.zip, r) as z:
... with z.open(filename_without.txt, r) as f:
... print(f.read())
... print(f.closed)
...
b'EOF\r\n'
True
--
components: +Library (Lib) -Extension
Ralph Broenink added the comment:
Perhaps this should be documented then :)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22154
___
___
Serhiy Storchaka added the comment:
May be.
--
assignee: - docs@python
components: +Documentation -Library (Lib)
keywords: +easy
nosy: +docs@python
priority: normal - low
resolution: out of date -
stage: resolved - needs patch
status: closed - open
type: enhancement - behavior