Message407800
> I think PR https://github.com/python/cpython/pull/28674 has resolved this issue.
You're right.
_threadmodule.c now uses _PyDeadline_Init() which calls _PyTime_Add(), and _PyTime_Add() prevents integer overflows; Extract of its implementation:
// Compute t1 + t2. Clamp to [_PyTime_MIN; _PyTime_MAX] on overflow.
static inline int
pytime_add(_PyTime_t *t1, _PyTime_t t2)
{
if (t2 > 0 && *t1 > _PyTime_MAX - t2) {
*t1 = _PyTime_MAX;
return -1;
}
else if (t2 < 0 && *t1 < _PyTime_MIN - t2) {
*t1 = _PyTime_MIN;
return -1;
}
else {
*t1 += t2;
return 0;
}
} |
|
Date |
User |
Action |
Args |
2021-12-06 13:26:08 | vstinner | set | recipients:
+ vstinner, pitrou, martin.panter, p-ganssle, ZackerySpytz, hongweipeng |
2021-12-06 13:26:08 | vstinner | set | messageid: <1638797168.54.0.162356056183.issue33632@roundup.psfhosted.org> |
2021-12-06 13:26:08 | vstinner | link | issue33632 messages |
2021-12-06 13:26:08 | vstinner | create | |
|