Message323676
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. |
|
Date |
User |
Action |
Args |
2018-08-17 21:56:49 | enedil | set | recipients:
+ enedil, lemburg, belopolsky, vstinner |
2018-08-17 21:56:49 | enedil | set | messageid: <1534543009.21.0.56676864532.issue34423@psf.upfronthosting.co.za> |
2018-08-17 21:56:49 | enedil | link | issue34423 messages |
2018-08-17 21:56:49 | enedil | create | |
|