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

arigo at codespeak.net arigo at codespeak.net
Fri Jun 15 12:05:15 CEST 2007

Author: arigo
Date: Fri Jun 15 12:05:14 2007
New Revision: 44278

Try to use signature.annotation() here, for 't.annotate([(float, float)])'.
The various type-to-annotation functions we have around the code need some
clean up and unification.

Modified: pypy/dist/pypy/annotation/annrpython.py
--- pypy/dist/pypy/annotation/annrpython.py	(original)
+++ pypy/dist/pypy/annotation/annrpython.py	Fri Jun 15 12:05:14 2007
@@ -5,6 +5,7 @@
 from pypy.annotation import model as annmodel
 from pypy.annotation.pairtype import pair
 from pypy.annotation.bookkeeper import Bookkeeper, getbookkeeper
+from pypy.annotation import signature
 from pypy.objspace.flow.model import Variable, Constant
 from pypy.objspace.flow.model import FunctionGraph
 from pypy.objspace.flow.model import c_last_exception, checkgraph
@@ -293,10 +294,7 @@
             raise TypeError, 'Variable or Constant expected, got %r' % (arg,)
     def typeannotation(self, t):
-        if isinstance(t, annmodel.SomeObject):
-            return t
-        else:
-            return self.bookkeeper.valueoftype(t)
+        return signature.annotation(t, self.bookkeeper)
     def ondegenerated(self, what, s_value, where=None, called_from_graph=None):
         if self.policy.allow_someobjects:

More information about the Pypy-commit mailing list