changeset: 97569:b690bf218702 user: Victor Stinner date: Wed Sep 02 01:57:23 2015 +0200 files: Misc/NEWS Modules/_datetimemodule.c description: 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. diff -r abeb625b20c2 -r b690bf218702 Misc/NEWS --- a/Misc/NEWS Wed Sep 02 01:43:56 2015 +0200 +++ b/Misc/NEWS Wed Sep 02 01:57:23 2015 +0200 @@ -17,6 +17,11 @@ 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 -r abeb625b20c2 -r b690bf218702 Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c Wed Sep 02 01:43:56 2015 +0200 +++ b/Modules/_datetimemodule.c Wed Sep 02 01:57:23 2015 +0200 @@ -4098,7 +4098,7 @@ long us; if (_PyTime_ObjectToTimeval(timestamp, - &timet, &us, _PyTime_ROUND_FLOOR) == -1) + &timet, &us, _PyTime_ROUND_HALF_UP) == -1) return NULL; return datetime_from_timet_and_us(cls, f, timet, (int)us, tzinfo);