This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients aconrad, belopolsky, larry, mark.dickinson, python-dev, r.david.murray, tbarbugli, tim.peters, trcarden, vivanov, vstinner
Date 2015-09-02.00:03:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1441152236.04.0.614242392719.issue23517@psf.upfronthosting.co.za>
In-reply-to
Content
Ok, I fixed the issue in Python 3.6. Example with the initial message:

$ python2.7 -c 'import datetime; print(datetime.datetime.utcfromtimestamp(1424817268.274).microsecond); print(datetime.datetime.utcfromtimestamp(-1424817268.274).microsecond)'
274000
726000

$ python3.6 -c 'import datetime; print(datetime.datetime.utcfromtimestamp(1424817268.274).microsecond); print(datetime.datetime.utcfromtimestamp(-1424817268.274).microsecond)'
274000
726000

I wrote:
"On Python < 3.3, datetime.datetime.fromtimestamp(float) doesn't use exactly ROUND_HALF_EVEN, but it looks more to "round half away from zero" (the decimal module doesn't seem to support this exact rounding method)."

I was wrong: it's decimal.ROUND_HALF_UP in fact.

I will backport the change to Python 3.4 and 3.5. Since this issue was defined as a bugfix, it should be fixed in Python 3.5.1 (too late for 3.5.0).
History
Date User Action Args
2015-09-02 00:03:56vstinnersetrecipients: + vstinner, tim.peters, mark.dickinson, belopolsky, larry, r.david.murray, aconrad, vivanov, python-dev, tbarbugli, trcarden
2015-09-02 00:03:56vstinnersetmessageid: <1441152236.04.0.614242392719.issue23517@psf.upfronthosting.co.za>
2015-09-02 00:03:56vstinnerlinkissue23517 messages
2015-09-02 00:03:55vstinnercreate