summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/zipfile.rst21
-rw-r--r--Doc/whatsnew/3.6.rst5
2 files changed, 13 insertions, 13 deletions
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index f5e161e..a7d1d69 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -204,18 +204,13 @@ ZipFile Objects
Return a list of archive members by name.
-.. index::
- single: universal newlines; zipfile.ZipFile.open method
-
.. method:: ZipFile.open(name, mode='r', pwd=None, *, force_zip64=False)
- Access a member of the archive as a file-like object. *name*
- is the name of the file in the archive, or a :class:`ZipInfo` object. The
- *mode* parameter, if included, must be one of the following: ``'r'`` (the
- default), ``'U'``, ``'rU'`` or ``'w'``. Choosing ``'U'`` or ``'rU'`` will
- enable :term:`universal newlines` support in the read-only object. *pwd* is
- the password used to decrypt encrypted ZIP files. Calling :meth:`.open` on
- a closed ZipFile will raise a :exc:`RuntimeError`.
+ Access a member of the archive as a binary file-like object. *name*
+ can be either the name of a file within the archive or a :class:`ZipInfo`
+ object. The *mode* parameter, if included, must be ``'r'`` (the default)
+ or ``'w'``. *pwd* is the password used to decrypt encrypted ZIP files.
+ Calling :meth:`.open` on a closed ZipFile will raise a :exc:`RuntimeError`.
:meth:`~ZipFile.open` is also a context manager and therefore supports the
:keyword:`with` statement::
@@ -224,7 +219,7 @@ ZipFile Objects
with myzip.open('eggs.txt') as myfile:
print(myfile.read())
- With *mode* ``'r'``, ``'U'`` or ``'rU'``, the file-like object
+ With *mode* ``'r'`` the file-like object
(``ZipExtFile``) is read-only and provides the following methods:
:meth:`~io.BufferedIOBase.read`, :meth:`~io.IOBase.readline`,
:meth:`~io.IOBase.readlines`, :meth:`__iter__`,
@@ -248,8 +243,8 @@ ZipFile Objects
or a :class:`ZipInfo` object. You will appreciate this when trying to read a
ZIP file that contains members with duplicate names.
- .. deprecated-removed:: 3.4 3.6
- The ``'U'`` or ``'rU'`` mode. Use :class:`io.TextIOWrapper` for reading
+ .. versionchanged:: 3.6
+ Removed support of ``mode='U'``. Use :class:`io.TextIOWrapper` for reading
compressed text files in :term:`universal newlines` mode.
.. versionchanged:: 3.6
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
index 5dc6076..3e3f62f 100644
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -580,6 +580,11 @@ API and Feature Removals
:mod:`tkinter` widget classes were removed (corresponding Tk commands
were obsolete since Tk 4.0).
+* The :meth:`~zipfile.ZipFile.open` method of the :class:`zipfile.ZipFile`
+ class no longer supports the ``'U'`` mode (was deprecated since Python 3.4).
+ Use :class:`io.TextIOWrapper` for reading compressed text files in
+ :term:`universal newlines` mode.
+
Porting to Python 3.6
=====================