summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-09-02 08:10:26 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-09-02 08:10:26 (GMT)
commita53ec7a91abb7cdbb1a13862f39d3183cab7f2a4 (patch)
treeefc22921e39c78260a77c39ee277d4a89544401b
parent265e1259e4ad7001ea366d52c56adde8daed7a69 (diff)
downloadcpython-a53ec7a91abb7cdbb1a13862f39d3183cab7f2a4.zip
cpython-a53ec7a91abb7cdbb1a13862f39d3183cab7f2a4.tar.gz
cpython-a53ec7a91abb7cdbb1a13862f39d3183cab7f2a4.tar.bz2
Backed out changeset b690bf218702
Issue #23517: the change broke test_datetime. datetime.timedelta() rounding mode must also be changed, and test_datetime must be updated for the new rounding mode (half up).
-rw-r--r--Misc/NEWS5
-rw-r--r--Modules/_datetimemodule.c2
2 files changed, 1 insertions, 6 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 8226f20..38f31e4 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -17,11 +17,6 @@ Core and Builtins
Library
-------
-- Issue #23517: datetime.datetime.fromtimestamp() and
- datetime.datetime.utcfromtimestamp() now rounds to nearest with ties going
- away from zero, instead of rounding towards minus infinity (-inf), as Python
- 2 and Python older than 3.3.
-
- Issue #23552: Timeit now warns when there is substantial (4x) variance
between best and worst times. Patch from Serhiy Storchaka.
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index e1cd2b5..5cff3f8 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -4098,7 +4098,7 @@ datetime_from_timestamp(PyObject *cls, TM_FUNC f, PyObject *timestamp,
long us;
if (_PyTime_ObjectToTimeval(timestamp,
- &timet, &us, _PyTime_ROUND_HALF_UP) == -1)
+ &timet, &us, _PyTime_ROUND_FLOOR) == -1)
return NULL;
return datetime_from_timet_and_us(cls, f, timet, (int)us, tzinfo);