mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
Patch #1576166: Support os.utime for directories on Windows NT+.
This commit is contained in:
parent
c9e82f6234
commit
18aaa568fd
3 changed files with 14 additions and 2 deletions
|
@ -2458,7 +2458,8 @@ posix_utime(PyObject *self, PyObject *args)
|
|||
wpath = PyUnicode_AS_UNICODE(obwpath);
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
hFile = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES, 0,
|
||||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
NULL, OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
Py_END_ALLOW_THREADS
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
return win32_error_unicode("utime", wpath);
|
||||
|
@ -2473,7 +2474,8 @@ posix_utime(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
hFile = CreateFileA(apath, FILE_WRITE_ATTRIBUTES, 0,
|
||||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
NULL, OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
Py_END_ALLOW_THREADS
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
win32_error("utime", apath);
|
||||
|
@ -8617,3 +8619,4 @@ INITFUNC(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue