summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-14 06:59:45 (GMT)
committerGeorg Brandl <georg@python.org>2010-10-14 06:59:45 (GMT)
commit268e4d4cf36ad79e71438fd864160892b335388d (patch)
tree38a3a4341983fa5caeb6dbaf1489587d665bae79 /Doc/library
parent77658bd9ad81674235f15cf120b195250b5b7c4d (diff)
downloadcpython-268e4d4cf36ad79e71438fd864160892b335388d.zip
cpython-268e4d4cf36ad79e71438fd864160892b335388d.tar.gz
cpython-268e4d4cf36ad79e71438fd864160892b335388d.tar.bz2
#1710703: write zipfile structures also in the case of closing a new, but empty, archive.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/zipfile.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index 09dd571..864ee48 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -117,6 +117,10 @@ ZipFile Objects
and :program:`unzip` commands on Unix (the InfoZIP utilities) don't support
these extensions.
+ If the file is created with mode ``'a'`` or ``'w'`` and then
+ :meth:`close`\ d without adding any files to the archive, the appropriate
+ ZIP structures for an empty archive will be written to the file.
+
ZipFile is also a context manager and therefore supports the
:keyword:`with` statement. In the example, *myzip* is closed after the
:keyword:`with` statement's suite is finished---even if an exception occurs::