[Python-checkins] r52335 - in python/trunk: Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c
martin.v.loewis
python-checkins at python.org
Sun Oct 15 10:43:34 CEST 2006
Author: martin.v.loewis
Date: Sun Oct 15 10:43:33 2006
New Revision: 52335
Modified:
python/trunk/Lib/test/test_os.py
python/trunk/Misc/NEWS
python/trunk/Modules/posixmodule.c
Log:
Patch #1576166: Support os.utime for directories on Windows NT+.
Modified: python/trunk/Lib/test/test_os.py
==============================================================================
--- python/trunk/Lib/test/test_os.py (original)
+++ python/trunk/Lib/test/test_os.py Sun Oct 15 10:43:33 2006
@@ -223,6 +223,13 @@
except TypeError:
pass
+ def test_utime_dir(self):
+ delta = 1000000
+ st = os.stat(test_support.TESTFN)
+ os.utime(test_support.TESTFN, (st.st_atime, st.st_mtime-delta))
+ st2 = os.stat(test_support.TESTFN)
+ self.assertEquals(st2.st_mtime, st.st_mtime-delta)
+
# Restrict test to Win32, since there is no guarantee other
# systems support centiseconds
if sys.platform == 'win32':
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sun Oct 15 10:43:33 2006
@@ -137,6 +137,8 @@
Extension Modules
-----------------
+- Patch #1576166: Support os.utime for directories on Windows NT+.
+
- Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode
arguments with the system default encoding just like the write()
method does, instead of converting it to a raw buffer.
Modified: python/trunk/Modules/posixmodule.c
==============================================================================
--- python/trunk/Modules/posixmodule.c (original)
+++ python/trunk/Modules/posixmodule.c Sun Oct 15 10:43:33 2006
@@ -2458,7 +2458,8 @@
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 @@
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 @@
}
#endif
+
More information about the Python-checkins
mailing list