[pypy-svn] r58271 - in pypy/branch/tuple-nonresizable-395/pypy: annotation/test rlib

fijal at codespeak.net fijal at codespeak.net
Sat Sep 20 16:50:01 CEST 2008


Author: fijal
Date: Sat Sep 20 16:50:00 2008
New Revision: 58271

Modified:
   pypy/branch/tuple-nonresizable-395/pypy/annotation/test/test_annrpython.py
   pypy/branch/tuple-nonresizable-395/pypy/rlib/debug.py
Log:
Make sure that make_sure_not_resized has no effect (besides warning)
when list comprehension is off. The reason behind is is that it's too
tedious to fix all the places. And eventually will force us to have
list comprehension optimization on ootype, because nice pictures will be
screwed by warnings.


Modified: pypy/branch/tuple-nonresizable-395/pypy/annotation/test/test_annrpython.py
==============================================================================
--- pypy/branch/tuple-nonresizable-395/pypy/annotation/test/test_annrpython.py	(original)
+++ pypy/branch/tuple-nonresizable-395/pypy/annotation/test/test_annrpython.py	Sat Sep 20 16:50:00 2008
@@ -3081,6 +3081,7 @@
             return func()
 
         a = self.RPythonAnnotator()
+        a.translator.config.translation.list_comprehension_operations = True
         py.test.raises(TooLateForChange, a.build_types, fn, [int])
             
 

Modified: pypy/branch/tuple-nonresizable-395/pypy/rlib/debug.py
==============================================================================
--- pypy/branch/tuple-nonresizable-395/pypy/rlib/debug.py	(original)
+++ pypy/branch/tuple-nonresizable-395/pypy/rlib/debug.py	Sat Sep 20 16:50:00 2008
@@ -92,7 +92,13 @@
     def compute_result_annotation(self, s_arg):
         from pypy.annotation.model import SomeList
         assert isinstance(s_arg, SomeList)
-        s_arg.listdef.never_resize()
+        # the logic behind it is that we try not to propagate
+        # make_sure_not_resized, when list comprehension is not on
+        if self.bookkeeper.annotator.translator.config.translation.list_comprehension_operations:
+            s_arg.listdef.never_resize()
+        else:
+            from pypy.annotation.annrpython import log
+            log.WARNING('make_sure_not_resized called, but has no effect since list_comprehension is off')
         return s_arg
     
     def specialize_call(self, hop):



More information about the Pypy-commit mailing list