diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-09-08 21:58:54 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-09-08 21:58:54 (GMT) |
commit | 69cc487df42d9064a74551ae26a8c115dade3e3a (patch) | |
tree | dc5407073d3fdeeae4049a2540852604f60ec986 /Lib/datetime.py | |
parent | 1638bdfa1a6f0183eef47dd43b1f0ab0f6b9f78d (diff) | |
download | cpython-69cc487df42d9064a74551ae26a8c115dade3e3a.zip cpython-69cc487df42d9064a74551ae26a8c115dade3e3a.tar.gz cpython-69cc487df42d9064a74551ae26a8c115dade3e3a.tar.bz2 |
Revert change 0eb8c182131e:
"""Issue #23517: datetime.timedelta constructor now rounds microseconds to
nearest with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python
older than 3.3, instead of rounding to nearest with ties going to nearest even
integer (ROUND_HALF_EVEN)."""
datetime.timedelta uses rounding mode ROUND_HALF_EVEN again.
Diffstat (limited to 'Lib/datetime.py')
-rw-r--r-- | Lib/datetime.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/datetime.py b/Lib/datetime.py index 6b2ac33..3c25ef8 100644 --- a/Lib/datetime.py +++ b/Lib/datetime.py @@ -407,7 +407,7 @@ class timedelta: # secondsfrac isn't referenced again if isinstance(microseconds, float): - microseconds = _round_half_up(microseconds + usdouble) + microseconds = round(microseconds + usdouble) seconds, microseconds = divmod(microseconds, 1000000) days, seconds = divmod(seconds, 24*3600) d += days @@ -418,7 +418,7 @@ class timedelta: days, seconds = divmod(seconds, 24*3600) d += days s += seconds - microseconds = _round_half_up(microseconds + usdouble) + microseconds = round(microseconds + usdouble) assert isinstance(s, int) assert isinstance(microseconds, int) assert abs(s) <= 3 * 24 * 3600 |