Ticket #9644: locmem_key_error.diff

File locmem_key_error.diff, 646 bytes (added by mrts, 16 years ago)

Avoid KeyErrors when another thread has deleted the key (btw, double try: needed for except: and finally: before Python 2.5, see PEP-0341)

  • django/core/cache/backends/locmem.py

     
    5858            self._lock.reader_leaves()
    5959        self._lock.writer_enters()
    6060        try:
    61             del self._cache[key]
    62             del self._expire_info[key]
     61            try:
     62                del self._cache[key]
     63                del self._expire_info[key]
     64            except KeyError:
     65                pass
    6366            return default
    6467        finally:
    6568            self._lock.writer_leaves()
Back to Top