Commit 20699809 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

locking: Add “__repr__” to SharedLock and PipeCondition



These help when debugging.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarAndrea Spadaccini <spadaccio@google.com>
parent 4958b41e
......@@ -357,6 +357,11 @@ class PipeCondition(_BaseCondition):
return bool(self._waiters)
def __repr__(self):
return ("<%s.%s waiters=%s at %#x>" %
(self.__class__.__module__, self.__class__.__name__,
self._waiters, id(self)))
class _PipeConditionWithMode(PipeCondition):
__slots__ = [
......@@ -436,6 +441,11 @@ class SharedLock(object):
logging.debug("Adding lock %s to monitor", name)
monitor.RegisterLock(self)
def __repr__(self):
return ("<%s.%s name=%s at %#x>" %
(self.__class__.__module__, self.__class__.__name__,
self.name, id(self)))
def GetLockInfo(self, requested):
"""Retrieves information for querying locks.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment