[pypy-svn] r36544 - in pypy/dist/pypy/annotation: . test

fijal at codespeak.net fijal at codespeak.net
Fri Jan 12 11:05:17 CET 2007


Author: fijal
Date: Fri Jan 12 11:05:12 2007
New Revision: 36544

Modified:
   pypy/dist/pypy/annotation/binaryop.py
   pypy/dist/pypy/annotation/model.py
   pypy/dist/pypy/annotation/test/test_annrpython.py
   pypy/dist/pypy/annotation/unaryop.py
Log:
(arigo, fijal) - variable renaming and additional check.


Modified: pypy/dist/pypy/annotation/binaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/binaryop.py	(original)
+++ pypy/dist/pypy/annotation/binaryop.py	Fri Jan 12 11:05:12 2007
@@ -686,7 +686,9 @@
 class __extend__(pairtype(SomeGenericCallable, SomePBC)):
     def union((gencall, pbc)):
         unique_key = (gencall, pbc.const)
-        getbookkeeper().emulate_pbc_call(unique_key, pbc, gencall.args_s)
+        s_result = getbookkeeper().emulate_pbc_call(unique_key, pbc,
+                                                    gencall.args_s)
+        assert gencall.s_result.contains(s_result)
         return gencall
 
 class __extend__(pairtype(SomeImpossibleValue, SomeObject)):

Modified: pypy/dist/pypy/annotation/model.py
==============================================================================
--- pypy/dist/pypy/annotation/model.py	(original)
+++ pypy/dist/pypy/annotation/model.py	Fri Jan 12 11:05:12 2007
@@ -35,7 +35,7 @@
 from pypy.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong, base_int
 import inspect
 from sys import maxint
-
+from pypy.annotation.description import FunctionDesc
 
 DEBUG = True    # set to False to disable recording of debugging information
 TLS = tlsobject()
@@ -396,9 +396,12 @@
 class SomeGenericCallable(SomeObject):
     """ Stands for external callable with known signature
     """
-    def __init__(self, args, retval):
+    def __init__(self, args, result):
         self.args_s = args
-        self.retval_s = retval
+        self.s_result = result
+
+    def can_be_None(self):
+        return True
 
 class SomeBuiltin(SomeObject):
     "Stands for a built-in function or method with special-cased analysis."

Modified: pypy/dist/pypy/annotation/test/test_annrpython.py
==============================================================================
--- pypy/dist/pypy/annotation/test/test_annrpython.py	(original)
+++ pypy/dist/pypy/annotation/test/test_annrpython.py	Fri Jan 12 11:05:12 2007
@@ -2454,10 +2454,11 @@
         def g(a):
             pass
         g._known_annotation_ = annmodel.SomeGenericCallable(
-            args=(annmodel.SomeInteger(),), retval=annmodel.SomeInteger())
+            args=(annmodel.SomeInteger(),), result=annmodel.SomeInteger())
 
         def fun():
             return g(1)
+
         a = self.RPythonAnnotator(policy=policy.AnnotatorPolicy())
         s = a.build_types(fun, [])
         assert isinstance(s, annmodel.SomeInteger)
@@ -2468,8 +2469,8 @@
             pass
         g._known_annotation_ = annmodel.SomeGenericCallable(
             args=[annmodel.SomeGenericCallable(args=[annmodel.SomeInteger()],
-                                               retval=annmodel.SomeInteger())],
-            retval=annmodel.SomeInteger())
+                                               result=annmodel.SomeInteger())],
+            result=annmodel.SomeInteger())
 
         def fun2(x):
             return x

Modified: pypy/dist/pypy/annotation/unaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/unaryop.py	(original)
+++ pypy/dist/pypy/annotation/unaryop.py	Fri Jan 12 11:05:12 2007
@@ -605,7 +605,8 @@
         bookkeeper = getbookkeeper()
         for arg, expected in zip(args.unpack()[0], self.args_s):
             assert expected.contains(arg)
-        return self.retval_s
+        
+        return self.s_result
 
 class __extend__(SomeExternalObject):
     def find_method(obj, name):



More information about the Pypy-commit mailing list