[pypy-svn] r12108 - pypy/dist/pypy/translator/genc

pedronis at codespeak.net pedronis at codespeak.net
Mon May 9 14:48:12 CEST 2005


Author: pedronis
Date: Mon May  9 14:48:12 2005
New Revision: 12108

Modified:
   pypy/dist/pypy/translator/genc/pyobjtype.py
Log:
more "robust" detection of '__builtin__' exceptions. the test framework itself substitute AssertionError so we need
to be careful. This logic should probably go to gensupp...




Modified: pypy/dist/pypy/translator/genc/pyobjtype.py
==============================================================================
--- pypy/dist/pypy/translator/genc/pyobjtype.py	(original)
+++ pypy/dist/pypy/translator/genc/pyobjtype.py	Mon May  9 14:48:12 2005
@@ -283,7 +283,9 @@
 
         metaclass = "type"
         if issubclass(cls, Exception):
-            if cls.__module__ == 'exceptions':
+            # if cls.__module__ == 'exceptions':
+            # don't rely on this, py.magic redefines AssertionError
+            if getattr(__builtin__,cls.__name__,None) is cls:
                 name = self.uniquename('gexc_' + cls.__name__)
                 self.initcode_python(name, cls.__name__)
                 return name



More information about the Pypy-commit mailing list