Skip to content

Commit 7508a54

Browse files
matrixiseJan-Philip Gehrcke
authored andcommitted
bpo-20709: os.utime(path_to_directory): wrong documentation for Windows. (GH-5469)
Remove the paragraph where we explain that os.utime() does not support a directory as path under Windows. Patch by Jan-Philip Gehrcke Co-authored-by: Jan-Philip Gehrcke <jgehrcke@gmail.com>
1 parent 335a602 commit 7508a54

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Doc/library/os.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,14 +2768,12 @@ features:
27682768

27692769
It is an error to specify tuples for both *times* and *ns*.
27702770

2771-
Whether a directory can be given for *path*
2772-
depends on whether the operating system implements directories as files
2773-
(for example, Windows does not). Note that the exact times you set here may
2774-
not be returned by a subsequent :func:`~os.stat` call, depending on the
2775-
resolution with which your operating system records access and modification
2776-
times; see :func:`~os.stat`. The best way to preserve exact times is to
2777-
use the *st_atime_ns* and *st_mtime_ns* fields from the :func:`os.stat`
2778-
result object with the *ns* parameter to `utime`.
2771+
Note that the exact times you set here may not be returned by a subsequent
2772+
:func:`~os.stat` call, depending on the resolution with which your operating
2773+
system records access and modification times; see :func:`~os.stat`. The best
2774+
way to preserve exact times is to use the *st_atime_ns* and *st_mtime_ns*
2775+
fields from the :func:`os.stat` result object with the *ns* parameter to
2776+
`utime`.
27792777

27802778
This function can support :ref:`specifying a file descriptor <path_fd>`,
27812779
:ref:`paths relative to directory descriptors <dir_fd>` and :ref:`not
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove the paragraph where we explain that os.utime() does not support a
2+
directory as path under Windows. Patch by Jan-Philip Gehrcke

0 commit comments

Comments
 (0)