Commit 0cf257c5 authored by Guido Trotter's avatar Guido Trotter
Browse files

Make LockSet.__names() return a list, not a set

Previously the private version of the __names function returned directly a set.
We'll keep this in the public interface but change the private version to a
list in order to be able to sort() its result and then loop on it, even though
we'll need to do this with the usual care that some keys may disappear in

Reviewed-by: imsnah
parent 3f404fc5
......@@ -331,7 +331,7 @@ class LockSet:
result after releasing the lock.
return set(self.__lockdict.keys())
return self.__lockdict.keys()
def _names(self):
"""Return a copy of the current set of elements.
......@@ -343,7 +343,7 @@ class LockSet:
result = self.__names()
return result
return set(result)
def acquire(self, names, blocking=1, shared=0):
"""Acquire a set of resource locks.
......@@ -467,7 +467,7 @@ class LockSet:
# conflicting add()
invalid_names = self.__names().intersection(names)
invalid_names = set(self.__names()).intersection(names)
if invalid_names:
# This must be an explicit raise, not an assert, because assert is
# turned off when using optimization, and this can happen because of
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