[Python-checkins] cpython: Backed out changeset b690bf218702

victor.stinner python-checkins at python.org
Wed Sep 2 10:41:02 CEST 2015


https://hg.python.org/cpython/rev/30454ef98e81
changeset:   97570:30454ef98e81
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Sep 02 10:10:26 2015 +0200
summary:
  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).

files:
  Misc/NEWS                 |  5 -----
  Modules/_datetimemodule.c |  2 +-
  2 files changed, 1 insertions(+), 6 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -17,11 +17,6 @@
 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
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -4098,7 +4098,7 @@
     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);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list