]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-41710: PyThread_acquire_lock_timed() clamps the timout (GH-28643)
authorVictor Stinner <vstinner@python.org>
Thu, 30 Sep 2021 08:16:51 +0000 (10:16 +0200)
committerGitHub <noreply@github.com>
Thu, 30 Sep 2021 08:16:51 +0000 (10:16 +0200)
commit37b8294d6295ca12553fd7c98778be71d24f4b24
tree8d9d17fb410224326246dbb25d762feb9aae6053
parenta1437170039dc2c07e6040d3a8ba8d91434b730d
bpo-41710: PyThread_acquire_lock_timed() clamps the timout (GH-28643)

PyThread_acquire_lock_timed() now clamps the timeout into the
[_PyTime_MIN; _PyTime_MAX] range (_PyTime_t type) if it is too large,
rather than calling Py_FatalError() which aborts the process.

PyThread_acquire_lock_timed() no longer uses
MICROSECONDS_TO_TIMESPEC() to compute sem_timedwait() argument, but
_PyTime_GetSystemClock() and _PyTime_AsTimespec_truncate().

Fix _thread.TIMEOUT_MAX value on Windows: the maximum timeout is
0x7FFFFFFF milliseconds (around 24.9 days), not 0xFFFFFFFF
milliseconds (around 49.7 days).

Set PY_TIMEOUT_MAX to 0x7FFFFFFF milliseconds, rather than 0xFFFFFFFF
milliseconds.

Fix PY_TIMEOUT_MAX overflow test: replace (us >= PY_TIMEOUT_MAX) with
(us > PY_TIMEOUT_MAX).
Include/cpython/pytime.h
Include/pythread.h
Misc/NEWS.d/next/C API/2021-09-30-03-14-35.bpo-41710.DDWJKx.rst [new file with mode: 0644]
Misc/NEWS.d/next/Library/2021-09-30-08-57-50.bpo-41710.JMsPAW.rst [new file with mode: 0644]
Modules/_queuemodule.c
Modules/_threadmodule.c
Modules/faulthandler.c
Python/thread_nt.h
Python/thread_pthread.h