File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -223,6 +223,13 @@ def test_statvfs_attributes(self):
223223 except TypeError :
224224 pass
225225
226+ def test_utime_dir (self ):
227+ delta = 1000000
228+ st = os .stat (test_support .TESTFN )
229+ os .utime (test_support .TESTFN , (st .st_atime , st .st_mtime - delta ))
230+ st2 = os .stat (test_support .TESTFN )
231+ self .assertEquals (st2 .st_mtime , st .st_mtime - delta )
232+
226233 # Restrict test to Win32, since there is no guarantee other
227234 # systems support centiseconds
228235 if sys .platform == 'win32' :
Original file line number Diff line number Diff line change @@ -137,6 +137,8 @@ Library
137137Extension Modules
138138-----------------
139139
140+ - Patch #1576166: Support os.utime for directories on Windows NT+.
141+
140142- Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode
141143 arguments with the system default encoding just like the write()
142144 method does, instead of converting it to a raw buffer.
Original file line number Diff line number Diff line change @@ -2458,7 +2458,8 @@ posix_utime(PyObject *self, PyObject *args)
24582458 wpath = PyUnicode_AS_UNICODE (obwpath );
24592459 Py_BEGIN_ALLOW_THREADS
24602460 hFile = CreateFileW (wpath , FILE_WRITE_ATTRIBUTES , 0 ,
2461- NULL , OPEN_EXISTING , 0 , NULL );
2461+ NULL , OPEN_EXISTING ,
2462+ FILE_FLAG_BACKUP_SEMANTICS , NULL );
24622463 Py_END_ALLOW_THREADS
24632464 if (hFile == INVALID_HANDLE_VALUE )
24642465 return win32_error_unicode ("utime ", wpath );
@@ -2473,7 +2474,8 @@ posix_utime(PyObject *self, PyObject *args)
24732474 return NULL ;
24742475 Py_BEGIN_ALLOW_THREADS
24752476 hFile = CreateFileA (apath , FILE_WRITE_ATTRIBUTES , 0 ,
2476- NULL , OPEN_EXISTING , 0 , NULL );
2477+ NULL , OPEN_EXISTING ,
2478+ FILE_FLAG_BACKUP_SEMANTICS , NULL );
24772479 Py_END_ALLOW_THREADS
24782480 if (hFile == INVALID_HANDLE_VALUE ) {
24792481 win32_error ("utime" , apath );
@@ -8617,3 +8619,4 @@ INITFUNC(void)
86178619}
86188620#endif
86198621
8622+
You can’t perform that action at this time.
0 commit comments