diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-06-11 16:32:44 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-06-11 16:32:44 (GMT) |
commit | e670be2273f93dfc262e16ebc27f0d453f15fa21 (patch) | |
tree | 62457246513f6e52590aaeffffe88a961e42e9b8 /Doc/library/zipfile.rst | |
parent | e6dae877dc119faadeae1df5a2792e3a02b66f7d (diff) | |
download | cpython-e670be2273f93dfc262e16ebc27f0d453f15fa21.zip cpython-e670be2273f93dfc262e16ebc27f0d453f15fa21.tar.gz cpython-e670be2273f93dfc262e16ebc27f0d453f15fa21.tar.bz2 |
Issue #27029: Removed deprecated support of universal newlines mode from ZipFile.open().
Diffstat (limited to 'Doc/library/zipfile.rst')
-rw-r--r-- | Doc/library/zipfile.rst | 21 |
1 files changed, 8 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 |