diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-11-16 16:56:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-16 16:56:57 (GMT) |
commit | a0652328a26757a90d63697b5c01f5427b1132b5 (patch) | |
tree | 6cd0b03474130783b7319cf94a4ec56f99e28eee /Doc/library/gzip.rst | |
parent | bd44a7ead9f7336d7bb45f186b2b6ca0300154f7 (diff) | |
download | cpython-a0652328a26757a90d63697b5c01f5427b1132b5.zip cpython-a0652328a26757a90d63697b5c01f5427b1132b5.tar.gz cpython-a0652328a26757a90d63697b5c01f5427b1132b5.tar.bz2 |
bpo-28286: Deprecate opening GzipFile for writing implicitly. (GH-16417)
Always specify the mode argument for writing.
Diffstat (limited to 'Doc/library/gzip.rst')
-rw-r--r-- | Doc/library/gzip.rst | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index 3349a94..33c4067 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -88,7 +88,8 @@ The module defines the following items: The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, ``'w'``, ``'wb'``, ``'x'``, or ``'xb'``, depending on whether the file will be read or written. The default is the mode of *fileobj* if discernible; otherwise, the - default is ``'rb'``. + default is ``'rb'``. In future Python releases the mode of *fileobj* will + not be used. It is better to always specify *mode* for writing. Note that the file is always opened in binary mode. To open a compressed file in text mode, use :func:`.open` (or wrap your :class:`GzipFile` with an @@ -164,6 +165,10 @@ The module defines the following items: .. versionchanged:: 3.6 Accepts a :term:`path-like object`. + .. deprecated:: 3.9 + Opening :class:`GzipFile` for writing without specifying the *mode* + argument is deprecated. + .. function:: compress(data, compresslevel=9, *, mtime=None) |