summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesús Leganés Combarro "Piranna" <piranna@gmail.com>2012-05-19 23:52:53 +0200
committerJesús Leganés Combarro "Piranna" <piranna@gmail.com>2012-05-19 23:52:53 +0200
commit26986faad381f72078921d15f777024ff88fd15c (patch)
treeed507b313ae9dd62b919745c76938a423b05394b
parentba9f29071a4011521cfe685ba1de30004b413ae6 (diff)
downloadsqlparse-26986faad381f72078921d15f777024ff88fd15c.tar.gz
Fixed bug on __getitem__ (infinite loop because pop() use it already)
-rw-r--r--sqlparse/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sqlparse/utils.py b/sqlparse/utils.py
index 016a292..cdf27b1 100644
--- a/sqlparse/utils.py
+++ b/sqlparse/utils.py
@@ -20,8 +20,9 @@ if OrderedDict:
self._maxsize = maxsize
def __getitem__(self, key, *args, **kwargs):
- # Remove the (key, value) pair from the cache, or raise KeyError
- value = self.pop(key)
+ # Get the key and remove it from the cache, or raise KeyError
+ value = OrderedDict.__getitem__(self, key)
+ del self[key]
# Insert the (key, value) pair on the front of the cache
OrderedDict.__setitem__(self, key, value)