[3.13] gh-125679: multiprocessing Lock and RLock - fix invalid representation string on MacOSX. (GH-125680) (#126533)

gh-125679: multiprocessing Lock and RLock - fix invalid representation string on MacOSX. (GH-125680)
(cherry picked from commit 75f7cf91ec)

Co-authored-by: Duprat <yduprat@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-11-07 10:49:31 +01:00 committed by GitHub
parent 07a6aa3f8f
commit 3b05ef10c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 126 additions and 2 deletions

View file

@ -174,7 +174,7 @@ class Lock(SemLock):
name = process.current_process().name
if threading.current_thread().name != 'MainThread':
name += '|' + threading.current_thread().name
elif self._semlock._get_value() == 1:
elif not self._semlock._is_zero():
name = 'None'
elif self._semlock._count() > 0:
name = 'SomeOtherThread'
@ -200,7 +200,7 @@ class RLock(SemLock):
if threading.current_thread().name != 'MainThread':
name += '|' + threading.current_thread().name
count = self._semlock._count()
elif self._semlock._get_value() == 1:
elif not self._semlock._is_zero():
name, count = 'None', 0
elif self._semlock._count() > 0:
name, count = 'SomeOtherThread', 'nonzero'