[Python-checkins] r52258 - in python/branches/release25-maint: Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c
martin.v.loewis
python-checkins at python.org
Mon Oct 9 22:44:52 CEST 2006
Author: martin.v.loewis
Date: Mon Oct 9 22:44:50 2006
New Revision: 52258
Modified:
python/branches/release25-maint/Lib/test/test_os.py
python/branches/release25-maint/Misc/NEWS
python/branches/release25-maint/Modules/posixmodule.c
Log:
Bug #1565150: Fix subsecond processing for os.utime on Windows.
Modified: python/branches/release25-maint/Lib/test/test_os.py
==============================================================================
--- python/branches/release25-maint/Lib/test/test_os.py (original)
+++ python/branches/release25-maint/Lib/test/test_os.py Mon Oct 9 22:44:50 2006
@@ -223,6 +223,14 @@
except TypeError:
pass
+ # Restrict test to Win32, since there is no guarantee other
+ # systems support centiseconds
+ if sys.platform == 'win32':
+ def test_1565150(self):
+ t1 = 1159195039.25
+ os.utime(self.fname, (t1, t1))
+ self.assertEquals(os.stat(self.fname).st_mtime, t1)
+
from test import mapping_tests
class EnvironTests(mapping_tests.BasicTestMappingProtocol):
Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS (original)
+++ python/branches/release25-maint/Misc/NEWS Mon Oct 9 22:44:50 2006
@@ -49,6 +49,8 @@
Extension Modules
-----------------
+- Bug #1565150: Fix subsecond processing for os.utime on Windows.
+
- Patch #1572724: fix typo ('=' instead of '==') in _msi.c.
- Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault
Modified: python/branches/release25-maint/Modules/posixmodule.c
==============================================================================
--- python/branches/release25-maint/Modules/posixmodule.c (original)
+++ python/branches/release25-maint/Modules/posixmodule.c Mon Oct 9 22:44:50 2006
@@ -792,7 +792,7 @@
/* XXX endianness */
__int64 out;
out = time_in + secs_between_epochs;
- out = out * 10000000 + nsec_in;
+ out = out * 10000000 + nsec_in / 100;
memcpy(out_ptr, &out, sizeof(out));
}
@@ -2501,11 +2501,11 @@
if (extract_time(PyTuple_GET_ITEM(arg, 0),
&atimesec, &ausec) == -1)
goto done;
- time_t_to_FILE_TIME(atimesec, ausec, &atime);
+ time_t_to_FILE_TIME(atimesec, 1000*ausec, &atime);
if (extract_time(PyTuple_GET_ITEM(arg, 1),
&mtimesec, &musec) == -1)
goto done;
- time_t_to_FILE_TIME(mtimesec, musec, &mtime);
+ time_t_to_FILE_TIME(mtimesec, 1000*musec, &mtime);
}
if (!SetFileTime(hFile, NULL, &atime, &mtime)) {
/* Avoid putting the file name into the error here,
More information about the Python-checkins
mailing list