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

pedronis at codespeak.net pedronis at codespeak.net
Thu Jun 2 13:51:18 CEST 2005


Author: pedronis
Date: Thu Jun  2 13:51:17 2005
New Revision: 12999

Modified:
   pypy/dist/pypy/annotation/bookkeeper.py
   pypy/dist/pypy/annotation/model.py
Log:
- don't add redudant .knowtype = object to SomeObjects

- valueoftype should try not to create classdefs for pbc types



Modified: pypy/dist/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/annotation/bookkeeper.py	(original)
+++ pypy/dist/pypy/annotation/bookkeeper.py	Thu Jun  2 13:51:17 2005
@@ -240,12 +240,13 @@
         elif t is dict:
             return SomeDict(MOST_GENERAL_DICTDEF)
         # can't do tuple
-        elif t.__module__ != '__builtin__':
+        elif t.__module__ != '__builtin__' and t not in self.pbctypes:
             classdef = self.getclassdef(t)
             return SomeInstance(classdef)
         else:
             o = SomeObject()
-            o.knowntype = t
+            if t != object:
+                o.knowntype = t
             return o
 
     def pbc_getattr(self, pbc, s_attr):

Modified: pypy/dist/pypy/annotation/model.py
==============================================================================
--- pypy/dist/pypy/annotation/model.py	(original)
+++ pypy/dist/pypy/annotation/model.py	Thu Jun  2 13:51:17 2005
@@ -263,12 +263,14 @@
         if self.isNone():
             self.knowntype = type(None)
         else:
-            self.knowntype = reduce(commonbase,
-                                    [new_or_old_class(x)
-                                     for x in prebuiltinstances
-                                     if x is not None])
-            if self.knowntype == type(Exception):
-                self.knowntype = type
+            knowntype = reduce(commonbase,
+                               [new_or_old_class(x)
+                                for x in prebuiltinstances
+                                if x is not None])
+            if knowntype == type(Exception):
+                knowntype = type
+            if knowntype != object:
+                self.knowntype = knowntype
         if prebuiltinstances.values() == [True]:
             # hack for the convenience of direct callers to SomePBC():
             # only if there is a single object in prebuiltinstances and



More information about the Pypy-commit mailing list