]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-74953: Fix PyThread_acquire_lock_timed() code recomputing the timeout (GH-93941)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 17 Jun 2022 14:39:27 +0000 (07:39 -0700)
committerGitHub <noreply@github.com>
Fri, 17 Jun 2022 14:39:27 +0000 (07:39 -0700)
Set timeout, don't create a local variable with the same name.
(cherry picked from commit f64557f4803528c53bb9a1d565e3cdf92e97152f)

Co-authored-by: Victor Stinner <vstinner@python.org>
Python/thread_pthread.h

index c90ab25d4841d814ddb94f27adc9d6137136d053..02c842772954593b59b95799c30cca1a9441ef88 100644 (file)
@@ -506,7 +506,7 @@ PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds,
 #ifndef HAVE_SEM_CLOCKWAIT
         if (timeout > 0) {
             /* wait interrupted by a signal (EINTR): recompute the timeout */
-            _PyTime_t timeout = _PyDeadline_Get(deadline);
+            timeout = _PyDeadline_Get(deadline);
             if (timeout < 0) {
                 status = ETIMEDOUT;
                 break;