https://github.com/python/cpython/commit/3bfb7da3d70884ec8ec192bcafe4f1744fecf358 commit: 3bfb7da3d70884ec8ec192bcafe4f1744fecf358 branch: 3.13 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: colesbury <colesb...@gmail.com> date: 2025-06-18T18:47:59Z summary:
[3.13] gh-135641: Fix flaky `test_capi.test_lock_two_threads` test case (gh-135642) (gh-135688) The mutex may have the `_Py_HAS_PARKED` bit set. (cherry picked from commit 17ac3933c3c860e08f7963cf270116a39a063be7) Co-authored-by: Sam Gross <colesb...@gmail.com> files: M Modules/_testinternalcapi/test_lock.c diff --git a/Modules/_testinternalcapi/test_lock.c b/Modules/_testinternalcapi/test_lock.c index 8d678412fe7179..8d8cb992b0e07f 100644 --- a/Modules/_testinternalcapi/test_lock.c +++ b/Modules/_testinternalcapi/test_lock.c @@ -57,7 +57,10 @@ lock_thread(void *arg) _Py_atomic_store_int(&test_data->started, 1); PyMutex_Lock(m); - assert(m->_bits == 1); + // gh-135641: in rare cases the lock may still have `_Py_HAS_PARKED` set + // (m->_bits == 3) due to bucket collisions in the parking lot hash table + // between this mutex and the `test_data.done` event. + assert(m->_bits == 1 || m->_bits == 3); PyMutex_Unlock(m); assert(m->_bits == 0); _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: arch...@mail-archive.com