Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a53ec7a

Browse files
committed
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).
1 parent 265e125 commit a53ec7a

2 files changed

Lines changed: 1 addition & 6 deletions

File tree

Misc/NEWS

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ Core and Builtins
1717
Library
1818
-------
1919

20-
- Issue #23517: datetime.datetime.fromtimestamp() and
21-
datetime.datetime.utcfromtimestamp() now rounds to nearest with ties going
22-
away from zero, instead of rounding towards minus infinity (-inf), as Python
23-
2 and Python older than 3.3.
24-
2520
- Issue #23552: Timeit now warns when there is substantial (4x) variance
2621
between best and worst times. Patch from Serhiy Storchaka.
2722

Modules/_datetimemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4098,7 +4098,7 @@ datetime_from_timestamp(PyObject *cls, TM_FUNC f, PyObject *timestamp,
40984098
long us;
40994099

41004100
if (_PyTime_ObjectToTimeval(timestamp,
4101-
&timet, &us, _PyTime_ROUND_HALF_UP) == -1)
4101+
&timet, &us, _PyTime_ROUND_FLOOR) == -1)
41024102
return NULL;
41034103

41044104
return datetime_from_timet_and_us(cls, f, timet, (int)us, tzinfo);

0 commit comments

Comments
 (0)