Skip to content

Commit

Permalink
Another attempt at fixing pypy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Apr 22, 2015
1 parent 97a7cc7 commit d62629f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion celery/tests/utils/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, cache):
def run(self):
while not self.__is_shutdown.isSet():
try:
self.cache.data.popitem(last=False)
self.cache.popitem(last=False)
except KeyError:
break
self.__is_stopped.set()
Expand Down
6 changes: 6 additions & 0 deletions celery/utils/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ def update(self, *args, **kwargs):
for item in islice(iter(data), len(data) - limit):
data.pop(item)

def popitem(self, last=True, _needs_lock=IS_PYPY):
if not _needs_lock:
return self.data.popitem(last)
with self.mutex:
return self.data.popitem(last)

def __setitem__(self, key, value):
# remove least recently used key.
with self.mutex:
Expand Down

0 comments on commit d62629f

Please sign in to comment.