[pypy-svn] r62174 - pypy/branch/pyjitpl5/pypy/rpython
arigo at codespeak.net
arigo at codespeak.net
Thu Feb 26 11:04:28 CET 2009
Author: arigo
Date: Thu Feb 26 11:04:26 2009
New Revision: 62174
Modified:
pypy/branch/pyjitpl5/pypy/rpython/llinterp.py
Log:
Fix an occasional KeyError in remember_free.
Modified: pypy/branch/pyjitpl5/pypy/rpython/llinterp.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rpython/llinterp.py (original)
+++ pypy/branch/pyjitpl5/pypy/rpython/llinterp.py Thu Feb 26 11:04:26 2009
@@ -166,7 +166,18 @@
self.mallocs[ptr._obj] = llframe
def remember_free(self, ptr):
- del self.mallocs[ptr._obj]
+ try:
+ del self.mallocs[ptr._obj]
+ except KeyError:
+ self._rehash_mallocs()
+ del self.mallocs[ptr._obj]
+
+ def _rehash_mallocs(self):
+ # rehashing is needed because some objects' hash may change
+ # when being turned to <C object>
+ items = self.mallocs.items()
+ self.mallocs = {}
+ self.mallocs.update(items)
def checkptr(ptr):
assert isinstance(lltype.typeOf(ptr), lltype.Ptr)
More information about the Pypy-commit
mailing list