[pypy-svn] r7793 - pypy/trunk/src/pypy/annotation

arigo at codespeak.net arigo at codespeak.net
Thu Dec 9 19:23:57 CET 2004


Author: arigo
Date: Thu Dec  9 19:23:55 2004
New Revision: 7793

Modified:
   pypy/trunk/src/pypy/annotation/binaryop.py
   pypy/trunk/src/pypy/annotation/model.py
   pypy/trunk/src/pypy/annotation/unaryop.py
Log:
- why does SomeBuiltin inherit from SomePBC?  Can't find a good reason any
  more...  Fixed.

- yet another hack in RPythonCallsSpace.



Modified: pypy/trunk/src/pypy/annotation/binaryop.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/binaryop.py	(original)
+++ pypy/trunk/src/pypy/annotation/binaryop.py	Thu Dec  9 19:23:55 2004
@@ -275,8 +275,6 @@
 
 class __extend__(pairtype(SomePBC, SomePBC)):
     def union((pbc1, pbc2)):
-        if isinstance(pbc1, SomeBuiltin) or isinstance(pbc2, SomeBuiltin):
-            assert False, "merging builtin & PBC == BAD!"
         if len(pbc2.prebuiltinstances) > len(pbc1.prebuiltinstances):
             pbc1, pbc2 = pbc2, pbc1
         d = pbc1.prebuiltinstances.copy()

Modified: pypy/trunk/src/pypy/annotation/model.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/model.py	(original)
+++ pypy/trunk/src/pypy/annotation/model.py	Thu Dec  9 19:23:55 2004
@@ -214,7 +214,7 @@
         else:
             return kt.__name__
 
-class SomeBuiltin(SomePBC):
+class SomeBuiltin(SomeObject):
     "Stands for a built-in function or method with special-cased analysis."
     knowntype = BuiltinFunctionType  # == BuiltinMethodType
     def __init__(self, analyser, s_self=None):

Modified: pypy/trunk/src/pypy/annotation/unaryop.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/unaryop.py	(original)
+++ pypy/trunk/src/pypy/annotation/unaryop.py	Thu Dec  9 19:23:55 2004
@@ -249,6 +249,14 @@
     def newdict(self, stuff):
         raise Exception, "call pattern too complicated (** argument)"
 
+    def unpackiterable(self, s_obj, expected_length=None):
+        if isinstance(s_obj, SomeTuple):
+            if (expected_length is not None and
+                expected_length != len(s_obj.items)):
+                raise ValueError
+            return s_obj.items
+        raise Exception, "RPythonCallsSpace.unpackiterable(): only for tuples"
+
     # XXX the following is only a hack to lead Arguments.parse() believe
     # XXX that the *arg is always a tuple!
     w_tuple = object()



More information about the Pypy-commit mailing list