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 enedil
Recipients belopolsky, enedil, lemburg, vstinner
Date 2018-08-17.21:56:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <[email protected]>
In-reply-to
Content
Code triggering bug:

import time
time.sleep(2**63 / 10**9)

Result:

ValueError: sleep length must be non-negative

The problem is with the macro that checks the range of provided double:

Line 228 of Include/pymath.h:
#define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type))

The type here is _PyTime_t, which is a typedef to int64_t. 

Proposed solution is to change <= into <, since float(2**63-1) == float(2**63), and that means that none double can ever be equal to 2**63-1.
History
Date User Action Args
2018-08-17 21:56:49enedilsetrecipients: + enedil, lemburg, belopolsky, vstinner
2018-08-17 21:56:49enedilsetmessageid: <[email protected]>
2018-08-17 21:56:49enedillinkissue34423 messages
2018-08-17 21:56:49enedilcreate