diff --git a/lib/locking.py b/lib/locking.py
index e49478534463de23e8d7ce7c87e67c1e5a1f41d5..7d65d3395334ce3f91fef2249d89c6285402daba 100644
--- a/lib/locking.py
+++ b/lib/locking.py
@@ -1191,7 +1191,7 @@ class LockSet:
     # they will still be there after, but this makes it a lot faster should
     # just one of them be the already wrong. Using a sorted sequence to prevent
     # deadlocks.
-    for lname in sorted(utils.UniqueSequence(names)):
+    for lname in sorted(frozenset(names)):
       try:
         lock = self.__lockdict[lname] # raises KeyError if lock is not there
       except KeyError: