aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/lock.c
diff options
context:
space:
mode:
authorJoseph Tibbertsma <josephtibbertsma@gmail.com>2025-06-25 09:41:36 -0700
committerGitHub <noreply@github.com>2025-06-25 16:41:36 +0000
commitcbfaf41caf135b8598a560854cd59e992a2ccfed (patch)
tree021ddd1a9eb29ffaebee3334c4b00b75f9a1c745 /Python/lock.c
parenta88b49c3f2184428124890741778e92c0fdb6446 (diff)
downloadcpython-cbfaf41caf135b8598a560854cd59e992a2ccfed.tar.gz
cpython-cbfaf41caf135b8598a560854cd59e992a2ccfed.zip
Fix needless spinning in `_PyMutex_LockTimed` with zero timeout (gh-135872)
The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed.
Diffstat (limited to 'Python/lock.c')
-rw-r--r--Python/lock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/lock.c b/Python/lock.c
index b125ad0c9e3..ea6ac00bfec 100644
--- a/Python/lock.c
+++ b/Python/lock.c
@@ -58,7 +58,7 @@ _PyMutex_LockTimed(PyMutex *m, PyTime_t timeout, _PyLockFlags flags)
return PY_LOCK_ACQUIRED;
}
}
- else if (timeout == 0) {
+ if (timeout == 0) {
return PY_LOCK_FAILURE;
}