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

mwh at codespeak.net mwh at codespeak.net
Thu Jun 23 14:20:46 CEST 2005


Author: mwh
Date: Thu Jun 23 14:20:44 2005
New Revision: 13710

Modified:
   pypy/dist/pypy/annotation/binaryop.py
   pypy/dist/pypy/annotation/bookkeeper.py
Log:
oops, need to be a little more clever.


Modified: pypy/dist/pypy/annotation/binaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/binaryop.py	(original)
+++ pypy/dist/pypy/annotation/binaryop.py	Thu Jun 23 14:20:44 2005
@@ -306,6 +306,7 @@
 class __extend__(pairtype(SomeString, SomeObject)):
 
     def mod((str, args)):
+        assert str.is_constant()
         getbookkeeper().count('strformat', str, args)
         return SomeString()
 

Modified: pypy/dist/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/annotation/bookkeeper.py	(original)
+++ pypy/dist/pypy/annotation/bookkeeper.py	Thu Jun 23 14:20:44 2005
@@ -133,6 +133,13 @@
     def consider_str_getitem(self, idx):
         return self.indexrepr(idx)
 
+    def consider_strformat(self, str, args):
+        if isinstance(args, SomeTuple):
+            return (str.const, tuple([self.typerepr(x) for x in args.items]))
+        else:
+            return (str.const, self.typerepr(args))
+            
+
 class Bookkeeper:
     """The log of choices that have been made while analysing the operations.
     It ensures that the same 'choice objects' will be returned if we ask



More information about the Pypy-commit mailing list