locking: Simplify condition
authorMichael Hanselmann <hansmi@google.com>
Mon, 19 Nov 2012 16:14:44 +0000 (17:14 +0100)
committerMichael Hanselmann <hansmi@google.com>
Mon, 19 Nov 2012 19:34:10 +0000 (20:34 +0100)
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/locking.py

index 014b378..cf7af34 100644 (file)
@@ -1050,8 +1050,8 @@ class LockSet:
       self.__owners[threading.currentThread()].remove(name)
 
     # Only remove the key if we don't hold the set-lock as well
-    if (not self.__lock.is_owned() and
-        not self.__owners[threading.currentThread()]):
+    if not (self.__lock.is_owned() or
+            self.__owners[threading.currentThread()]):
       del self.__owners[threading.currentThread()]
 
   def list_owned(self):