[pypy-svn] r35624 - pypy/dist/pypy/rpython

arigo at codespeak.net arigo at codespeak.net
Tue Dec 12 12:40:22 CET 2006


Author: arigo
Date: Tue Dec 12 12:40:21 2006
New Revision: 35624

Modified:
   pypy/dist/pypy/rpython/annlowlevel.py
Log:
A hackish fix for the case where building the cached object fails...
or raises py.test.Skip, as in some of the test_genc_ts tests in the
i386 backend :-/


Modified: pypy/dist/pypy/rpython/annlowlevel.py
==============================================================================
--- pypy/dist/pypy/rpython/annlowlevel.py	(original)
+++ pypy/dist/pypy/rpython/annlowlevel.py	Tue Dec 12 12:40:21 2006
@@ -492,5 +492,13 @@
             return d[args]
         except KeyError:
             instance = d[args] = selfcls.__new__(selfcls, *args)
-            instance.__init__(*args)
+            try:
+                instance.__init__(*args)
+            except:
+                # If __init__ fails, remove the 'instance' from d.
+                # That's a "best effort" attempt, it's not really enough
+                # in theory because some other place might have grabbed
+                # a reference to the same broken 'instance' in the meantime
+                del d[args]
+                raise
             return instance



More information about the Pypy-commit mailing list