Skip to content

Commit 18af009

Browse files
Apply suggestions from code review
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent b9bffb5 commit 18af009

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

Doc/whatsnew/3.16.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ gzip
9191
----
9292

9393
* :func:`gzip.open` now accepts an optional argument ``mtime``
94-
which is passed on to the init constructor of the GzipFile class.
94+
which is passed on to the constructor of the :class:`~gzip.GzipFile` class.
9595
(Contributed by Marin Misur in :gh:`91372`.)
9696

9797
os

Lib/gzip.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ def open(filename, mode="rb", compresslevel=_COMPRESS_LEVEL_TRADEOFF,
6565
if isinstance(filename, (str, bytes, os.PathLike)):
6666
binary_file = GzipFile(filename, gz_mode, compresslevel, mtime=mtime)
6767
elif hasattr(filename, "read") or hasattr(filename, "write"):
68-
binary_file = GzipFile(None, gz_mode, compresslevel, filename, mtime=mtime)
68+
binary_file = GzipFile(None, gz_mode, compresslevel, filename,
69+
mtime=mtime)
6970
else:
7071
raise TypeError("filename must be a str or bytes object, or a file")
7172

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Added a mtime option to gzip open().
2-
open() didn't have it, while init of class GzipFile has mtime as an optional argument.
1+
Added *mtime* option to :func:`gzip.open`, which will be passed
2+
to the constructor of :class:`~gzip.GzipFile`.

0 commit comments

Comments
 (0)