[pypy-svn] r17785 - in pypy/dist/pypy: objspace/std translator

pedronis at codespeak.net pedronis at codespeak.net
Fri Sep 23 12:51:39 CEST 2005


Author: pedronis
Date: Fri Sep 23 12:51:38 2005
New Revision: 17785

Modified:
   pypy/dist/pypy/objspace/std/objspace.py
   pypy/dist/pypy/translator/ann_override.py
Log:
avoid producing manye identical versions of wrap for the BaseWrappable case



Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py	(original)
+++ pypy/dist/pypy/objspace/std/objspace.py	Fri Sep 23 12:51:38 2005
@@ -289,7 +289,7 @@
         from fake import fake_object
         return fake_object(self, x)
 
-    wrap._annspecialcase_ = "specialize:argtype1"
+    wrap._annspecialcase_ = "specialize:wrap"
 
     def wrap_exception_cls(self, x):
         """NOT_RPYTHON"""

Modified: pypy/dist/pypy/translator/ann_override.py
==============================================================================
--- pypy/dist/pypy/translator/ann_override.py	(original)
+++ pypy/dist/pypy/translator/ann_override.py	Fri Sep 23 12:51:38 2005
@@ -34,6 +34,14 @@
         clsdef = getbookkeeper().getclassdef(pycode.PyCode)
         return annmodel.SomeInstance(clsdef)    
 
+    def specialize__wrap(pol, bookkeeper, mod, spaceop, func, args, mono):
+        from pypy.interpreter.baseobjspace import BaseWrappable
+        ignore, args_w = args.flatten()
+        typ = args_w[1].knowntype
+        if issubclass(typ, BaseWrappable):
+            typ = BaseWrappable
+        return (func, typ), args
+    
     def attach_lookup(pol, t, attr):
         cached = "cached_%s" % attr
         if not t.is_heaptype():



More information about the Pypy-commit mailing list