STINNER Victor <vstin...@python.org> added the comment:

> 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;
    }
}

----------
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
superseder:  -> threading.Lock.acquire(timeout) should use 
sem_clockwait(CLOCK_MONOTONIC)

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33632>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to