diff options
author | Victor Stinner <vstinner@python.org> | 2023-10-02 16:07:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-02 16:07:56 (GMT) |
commit | 4d0d1c3866cc408ff3382a9a0220ac0e4f2b3b34 (patch) | |
tree | e64710870fc9e41b50cba8b563e2a509ea39309a /Include/cpython | |
parent | 732ad44cec971be5255b1accbac6555d3615c2bf (diff) | |
download | cpython-4d0d1c3866cc408ff3382a9a0220ac0e4f2b3b34.zip cpython-4d0d1c3866cc408ff3382a9a0220ac0e4f2b3b34.tar.gz cpython-4d0d1c3866cc408ff3382a9a0220ac0e4f2b3b34.tar.bz2 |
gh-110014: Remove PY_TIMEOUT_MAX from limited C API (#110217)
If the timeout is greater than PY_TIMEOUT_MAX,
PyThread_acquire_lock_timed() uses a timeout of PY_TIMEOUT_MAX
microseconds, which is around 280.6 years. This case is unlikely and
limiting a timeout to 280.6 years sounds like a reasonable trade-off.
The constant PY_TIMEOUT_MAX is not used in PyPI top 5,000 projects.
Diffstat (limited to 'Include/cpython')
-rw-r--r-- | Include/cpython/pythread.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Include/cpython/pythread.h b/Include/cpython/pythread.h index cd2aab7..03f710a 100644 --- a/Include/cpython/pythread.h +++ b/Include/cpython/pythread.h @@ -2,6 +2,14 @@ # error "this header file must not be included directly" #endif +// PY_TIMEOUT_MAX is the highest usable value (in microseconds) of PY_TIMEOUT_T +// type, and depends on the system threading API. +// +// NOTE: this isn't the same value as `_thread.TIMEOUT_MAX`. The _thread module +// exposes a higher-level API, with timeouts expressed in seconds and +// floating-point numbers allowed. +PyAPI_DATA(const long long) PY_TIMEOUT_MAX; + #define PYTHREAD_INVALID_THREAD_ID ((unsigned long)-1) #ifdef HAVE_PTHREAD_H |