From 2a21bc88b10ff8476450c1816e86efd4d834b915 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 29 Jan 2009 15:08:46 +0000
Subject: [PATCH] locking.LockSet: don't modify input arguments

Currently LockSet.acquire() sorts in place it's input argument if it's a
list. This is not good, since callers might depend on a specific
ordering of the input data, and this is a 'hidden' modification.

We fix it by simply using a sorted copy, instead of sorting in place.

Reviewed-by: ultrotter
---
 lib/locking.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/locking.py b/lib/locking.py
index df6219aca..647e14f4c 100644
--- a/lib/locking.py
+++ b/lib/locking.py
@@ -451,7 +451,7 @@ class LockSet:
       if isinstance(names, basestring):
         names = [names]
       else:
-        names.sort()
+        names = sorted(names)
 
       acquire_list = []
       # First we look the locks up on __lockdict. We have no way of being sure
-- 
GitLab