[Python-checkins] cpython: Issue #19727: os.utime(..., None) is now potentially more precise under Windows.

antoine.pitrou python-checkins at python.org
Sat Nov 23 15:23:34 CET 2013


http://hg.python.org/cpython/rev/6a9e262c5423
changeset:   87419:6a9e262c5423
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sat Nov 23 15:23:26 2013 +0100
summary:
  Issue #19727: os.utime(..., None) is now potentially more precise under Windows.

files:
  Misc/NEWS             |  3 +++
  Modules/posixmodule.c |  9 ++-------
  2 files changed, 5 insertions(+), 7 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -68,6 +68,9 @@
 Library
 -------
 
+- Issue #19727: os.utime(..., None) is now potentially more precise
+  under Windows.
+
 - Issue #17201: ZIP64 extensions now are enabled by default.  Patch by
   William Mallard.
 
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -4953,13 +4953,8 @@
     }
 
     if (utime.now) {
-        SYSTEMTIME now;
-        GetSystemTime(&now);
-        if (!SystemTimeToFileTime(&now, &mtime) ||
-            !SystemTimeToFileTime(&now, &atime)) {
-            PyErr_SetFromWindowsErr(0);
-            goto exit;
-        }
+        GetSystemTimeAsFileTime(&mtime);
+        atime = mtime;
     }
     else {
         time_t_to_FILE_TIME(utime.atime_s, utime.atime_ns, &atime);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list