[pypy-svn] r10948 - pypy/dist/pypy/annotation

pedronis at codespeak.net pedronis at codespeak.net
Thu Apr 21 04:10:42 CEST 2005


Author: pedronis
Date: Thu Apr 21 04:10:42 2005
New Revision: 10948

Modified:
   pypy/dist/pypy/annotation/classdef.py
Log:
MI with Exception and BaseWrappable bits again, we need to support in union too



Modified: pypy/dist/pypy/annotation/classdef.py
==============================================================================
--- pypy/dist/pypy/annotation/classdef.py	(original)
+++ pypy/dist/pypy/annotation/classdef.py	Thu Apr 21 04:10:42 2005
@@ -53,10 +53,12 @@
         sources = {}
         baselist = list(cls.__bases__)
         baselist.reverse()
+        self.also_Exception_subclass = False
         if Exception in baselist and len(baselist)>1: # special-case
             baselist.remove(Exception)
             mixeddict['__init__'] = Exception.__init__.im_func
-        
+            self.also_Exception_subclass = True
+
         for b1 in baselist:
             if b1 is object:
                 continue
@@ -106,8 +108,13 @@
         return "<ClassDef '%s.%s'>" % (self.cls.__module__, self.cls.__name__)
 
     def commonbase(self, other):
+        other1 = other
         while other is not None and not issubclass(self.cls, other.cls):
             other = other.basedef
+        # special case for MI with Exception
+        if not other:
+            if issubclass(self.cls, Exception) and issubclass(other1.cls, Exception):
+                return self.bookkeeper.getclassdef(Exception)
         return other
 
     def superdef_containing(self, cls):



More information about the Pypy-commit mailing list