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 benjamin.peterson, graingert, vstinner
Date 2020-01-09.14:52:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1578581527.5.0.932903594264.issue39277@roundup.psfhosted.org>
In-reply-to
Content
It's a bug in _PyTime_FromDouble() which fails to detect the integer overflow when casting a C double to a C _PyTime_T (int64_t): bug in _Py_InIntegralTypeRange(_PyTime_t, d) where d is a C double.

On my Fedora 31, double is a 64-bit IEEE 754 float, _PyTime_t is int64_t (64-bit signed integer).

_PyTime_t maximum is 9223372036854775807. But casted as C double, it becomes 9223372036854775808:

>>> int(float(9223372036854775807))
9223372036854775808
History
Date User Action Args
2020-01-09 14:52:07vstinnersetrecipients: + vstinner, benjamin.peterson, graingert
2020-01-09 14:52:07vstinnersetmessageid: <1578581527.5.0.932903594264.issue39277@roundup.psfhosted.org>
2020-01-09 14:52:07vstinnerlinkissue39277 messages
2020-01-09 14:52:07vstinnercreate