You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The new multiprocessing.[R]Lock.locked() method fails. #132561
In the lockedmethod, the call to self._semlock._count() != 0 is not appropriate. The internal count attribute is really used with multiprocessing.RLock to count number of reentrant calls to acquire for the current thread.
With multiprocessing.Lock, this count is set to 1 when the lock is acquired (only once).
Whatever, only other threads can obtain this value, but not other processes sharing the [R]Lock.
IMO the test should be replace with self._semlock._is_zero() and the example above should also be add as unit test.
Activity
YvesDup commentedon Apr 15, 2025
I am wondering if the
lockedmethod should not be move frommultiprocessing.SemLocktomultiprocessing.Lockaccording to the documentation.sobolevn commentedon Apr 15, 2025
Oups, this was mine commit :)
Thanks a lot for the report. Would you like to send a PR with the fix?
gh-132561: Fix the public `multiprocessing.SemLock.locked` method (#1…
ambv commentedon Apr 23, 2025
This broke the FreeBSD 14 buildbot, @YvesDup: https://buildbot.python.org/#/builders/1232/builds/5366
vstinner commentedon Apr 23, 2025
It should be fixed by #132842 but I missed the rlock test :-( I wrote #132846 to skip also the rlock test.
vstinner commentedon Apr 24, 2025
FreeBSD buildbots are back to green. I close the issue.