[3.14] gh-134323: Fix the new threading.RLock.locked method (GH-134368) (#134510)

gh-134323: Fix the new `threading.RLock.locked` method (GH-134368)
(cherry picked from commit 3effede97c)

Co-authored-by: Duprat <yduprat@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Miss Islington (bot) 2025-05-22 16:14:53 +02:00 committed by GitHub
parent 7e7391810f
commit ced49a196f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 4 deletions

View file

@ -165,7 +165,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,
@ -244,7 +244,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