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

arigo at codespeak.net arigo at codespeak.net
Fri Aug 3 15:12:58 CEST 2007


Author: arigo
Date: Fri Aug  3 15:12:57 2007
New Revision: 45473

Modified:
   pypy/dist/pypy/rpython/extfunc.py
Log:
A case where an exception can obscurely mask a previous problem.


Modified: pypy/dist/pypy/rpython/extfunc.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunc.py	(original)
+++ pypy/dist/pypy/rpython/extfunc.py	Fri Aug  3 15:12:57 2007
@@ -1,3 +1,4 @@
+from pypy.rpython import extregistry
 from pypy.rpython.extregistry import ExtRegistryEntry
 from pypy.rpython.lltypesystem.lltype import typeOf
 from pypy.objspace.flow.model import Constant
@@ -20,6 +21,12 @@
     except:
         exc, exc_inst, tb = sys.exc_info()
         for func in funcs:
+            # if the function has already been registered and we got
+            # an exception afterwards, the ExtRaisingEntry would create
+            # a double-registration and crash in an AssertionError that
+            # masks the original problem.  In this case, just re-raise now.
+            if extregistry.lookup(func):
+                raise exc, exc_inst, tb
             class ExtRaisingEntry(ExtRegistryEntry):
                 _about_ = func
                 def compute_result_annotation(self, *args_s):



More information about the Pypy-commit mailing list