New submission from Jan-Philip Gehrcke:

The os.utime() docs for Python 2 
(http://docs.python.org/2/library/os.html#os.utime) and 3 
(http://docs.python.org/3/library/os.html#os.utime) both contain the sentence

"Whether a directory can be given for path depends on whether the operating 
system implements directories as files (for example, *Windows does not*)"

"Windoes does not" is wrong. CPython 2.7 on Windows 7:

>>> os.utime(".", (100, 100))
>>> os.stat(".").st_mtime
100.0

We should
- either name a specific system for which this does not work
- or remove this example.

Windows XP and newer support this operation via SetFileTime 
(http://msdn.microsoft.com/en-us/library/windows/desktop/ms724933%28v=vs.85%29.aspx):
 "Sets the date and time that the specified file or directory was created, last 
accessed, or last modified."

I have grepped myself through a couple of CPython source trees and found

posixmodule.c:        if (!SetFileTime(hFile, NULL, &atime, &mtime)

in 2.5, 2.6, 2.7. I guess the statement comes from 2.4 times, where 
`SetFileTime` only appears in `PC/bdist_wininst/extract.c`.

So, do we just remove the hint or does someone have an example at hand for 
which combination of Python and platform this does not work for directories? 
Once we have a decision, I will be happy to provide the mini patch.

----------
assignee: docs@python
components: Documentation
messages: 211760
nosy: docs@python, jgehrcke
priority: normal
severity: normal
status: open
title: os.utime(path_to_directory): wrong documentation for Windows.
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20709>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to