From 6d03bbae1a4fa9218cccc756106f6e0f2020c019 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 17 Jun 2022 16:11:25 +0200 Subject: [PATCH] gh-74953: Fix PyThread_acquire_lock_timed() code recomputing the timeout (GH-93941) Set timeout, don't create a local variable with the same name. (cherry picked from commit f64557f4803528c53bb9a1d565e3cdf92e97152f) Co-authored-by: Victor Stinner --- Python/thread_pthread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index c90ab25d4841d8..02c84277295459 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -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;