[Python-checkins] gh-74953: Fix PyThread_acquire_lock_timed() code recomputing the timeout (#93941)

vstinner webhook-mailer at python.org
Fri Jun 17 10:11:29 EDT 2022


https://github.com/python/cpython/commit/f64557f4803528c53bb9a1d565e3cdf92e97152f
commit: f64557f4803528c53bb9a1d565e3cdf92e97152f
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2022-06-17T16:11:25+02:00
summary:

gh-74953: Fix PyThread_acquire_lock_timed() code recomputing the timeout (#93941)

Set timeout, don't create a local variable with the same name.

files:
M Python/thread_pthread.h

diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index 195b277dfba50..58b5999add388 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -497,7 +497,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;



More information about the Python-checkins mailing list