From 34ca3914ee4ef14462c77958719c51d04d438818 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Mon, 18 Aug 2008 12:50:22 +0000 Subject: [PATCH] LockSet: allow lists with duplicate values If a list with a duplicate value is passed to a lockset what the code now does is to try to acquire the lock twice, generating a double-acquire exception in the SharedLock code. This is definitely an issue. In order to solve it we can either forbit double values in a list or just delete the duplicates. In this patch we go for the latter solution, removing any duplicate values when creating the acquire_list. Reviewed-by: imsnah --- lib/locking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/locking.py b/lib/locking.py index 2144735c7..a35c25873 100644 --- a/lib/locking.py +++ b/lib/locking.py @@ -452,7 +452,7 @@ class LockSet: # First we look the locks up on __lockdict. We have no way of being sure # they will still be there after, but this makes it a lot faster should # just one of them be the already wrong - for lname in names: + for lname in utils.UniqueSequence(names): try: lock = self.__lockdict[lname] # raises KeyError if lock is not there acquire_list.append((lname, lock)) -- GitLab