mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
gh-134323: Fix the new threading.RLock.locked
method (#134368)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
bd4046f4f8
commit
3effede97c
4 changed files with 29 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue