The free threading build could spin unnecessarily on `_Py_yield()` if the initial
compare and swap failed.
(cherry picked from commit
cbfaf41caf135b8598a560854cd59e992a2ccfed)
Co-authored-by: Joseph Tibbertsma <josephtibbertsma@gmail.com>
--- /dev/null
+Non-blocking mutex lock attempts now return immediately when the lock is busy
+instead of briefly spinning in the :term:`free threading` build.
return PY_LOCK_ACQUIRED;
}
}
- else if (timeout == 0) {
+ if (timeout == 0) {
return PY_LOCK_FAILURE;
}