diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-29 23:02:57 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-29 23:02:57 (GMT) |
commit | dca028b86ade11441554f8cdb9d2ae56c119b413 (patch) | |
tree | 8d549aa0c6218499f9c61c2f3369d32386b7e9d0 | |
parent | f81f0f9c63c8ae306d550b5bb387abf30e60a668 (diff) | |
download | cpython-dca028b86ade11441554f8cdb9d2ae56c119b413.zip cpython-dca028b86ade11441554f8cdb9d2ae56c119b413.tar.gz cpython-dca028b86ade11441554f8cdb9d2ae56c119b413.tar.bz2 |
Issue #22117: Fix os.utime(), it now rounds the timestamp towards minus
infinity (-inf) instead of rounding towards zero.
Replace _PyTime_ROUND_DOWN with _PyTime_ROUND_FLOOR.
-rw-r--r-- | Misc/NEWS | 3 | ||||
-rw-r--r-- | Modules/posixmodule.c | 4 |
2 files changed, 5 insertions, 2 deletions
@@ -30,6 +30,9 @@ Core and Builtins Library ------- +- Issue #22117: Fix os.utime(), it now rounds the timestamp towards minus + infinity (-inf) instead of rounding towards zero. + - Issue #14260: The groupindex attribute of regular expression pattern object now is non-modifiable mapping. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 9a44d46..801305f 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6127,9 +6127,9 @@ os_utime_impl(PyModuleDef *module, path_t *path, PyObject *times, PyObject *ns, } utime.now = 0; if (_PyTime_ObjectToTimespec(PyTuple_GET_ITEM(times, 0), - &a_sec, &a_nsec, _PyTime_ROUND_DOWN) == -1 || + &a_sec, &a_nsec, _PyTime_ROUND_FLOOR) == -1 || _PyTime_ObjectToTimespec(PyTuple_GET_ITEM(times, 1), - &m_sec, &m_nsec, _PyTime_ROUND_DOWN) == -1) { + &m_sec, &m_nsec, _PyTime_ROUND_FLOOR) == -1) { goto exit; } utime.atime_s = a_sec; |