diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2015-09-09 01:02:23 +0200 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2015-09-09 01:02:23 +0200 |
| commit | 7667f58151d5efbbae4f0b1d7178f99dad0d74c0 (patch) | |
| tree | 99928f745f6377adbf42d8892f30ec1de75a2559 /Modules/_testcapimodule.c | |
| parent | 69cc487df42d9064a74551ae26a8c115dade3e3a (diff) | |
| download | cpython-git-7667f58151d5efbbae4f0b1d7178f99dad0d74c0.tar.gz | |
Issue #23517: fromtimestamp() and utcfromtimestamp() methods of
datetime.datetime now round microseconds to nearest with ties going to nearest
even integer (ROUND_HALF_EVEN), as round(float), instead of rounding towards
-Infinity (ROUND_FLOOR).
pytime API: replace _PyTime_ROUND_HALF_UP with _PyTime_ROUND_HALF_EVEN. Fix
also _PyTime_Divide() for negative numbers.
_PyTime_AsTimeval_impl() now reuses _PyTime_Divide() instead of reimplementing
rounding modes.
Diffstat (limited to 'Modules/_testcapimodule.c')
| -rw-r--r-- | Modules/_testcapimodule.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index c38d9ae634..fed3286ac1 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2648,7 +2648,7 @@ check_time_rounding(int round) { if (round != _PyTime_ROUND_FLOOR && round != _PyTime_ROUND_CEILING - && round != _PyTime_ROUND_HALF_UP) { + && round != _PyTime_ROUND_HALF_EVEN) { PyErr_SetString(PyExc_ValueError, "invalid rounding"); return -1; } |
