gh-134323: Fix the new threading.RLock.locked method (#134368)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Duprat 2025-05-22 15:48:24 +02:00 committed by GitHub
parent bd4046f4f8
commit 3effede97c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 4 deletions

View file

@ -158,7 +158,7 @@ class _RLock:
except KeyError:
pass
return "<%s %s.%s object owner=%r count=%d at %s>" % (
"locked" if self._block.locked() else "unlocked",
"locked" if self.locked() else "unlocked",
self.__class__.__module__,
self.__class__.__qualname__,
owner,
@ -237,7 +237,7 @@ class _RLock:
def locked(self):
"""Return whether this object is locked."""
return self._count > 0
return self._block.locked()
# Internal methods used by condition variables