From 20699809e8c9ecdcc4a518d5eed659d6b847b9ef Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 19 Dec 2011 15:21:04 +0100
Subject: [PATCH] =?UTF-8?q?locking:=20Add=20=E2=80=9C=5F=5Frepr=5F=5F?=
 =?UTF-8?q?=E2=80=9D=20to=20SharedLock=20and=20PipeCondition?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

These help when debugging.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Andrea Spadaccini <spadaccio@google.com>
---
 lib/locking.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/locking.py b/lib/locking.py
index 26345632e..5b7414dcf 100644
--- a/lib/locking.py
+++ b/lib/locking.py
@@ -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.
 
-- 
GitLab