[pypy-commit] pypy default: test and fix

arigo noreply at buildbot.pypy.org
Sat May 10 17:14:34 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r71439:6a78aac458a8
Date: 2014-05-10 17:14 +0200
http://bitbucket.org/pypy/pypy/changeset/6a78aac458a8/

Log:	test and fix

diff --git a/rpython/rlib/debug.py b/rpython/rlib/debug.py
--- a/rpython/rlib/debug.py
+++ b/rpython/rlib/debug.py
@@ -288,7 +288,9 @@
     _about_ = make_sure_not_resized
 
     def compute_result_annotation(self, s_arg):
-        from rpython.annotator.model import SomeList
+        from rpython.annotator.model import SomeList, s_None
+        if s_None.contains(s_arg):
+            return s_arg    # only None: just return
         assert isinstance(s_arg, SomeList)
         # the logic behind it is that we try not to propagate
         # make_sure_not_resized, when list comprehension is not on
diff --git a/rpython/rlib/test/test_debug.py b/rpython/rlib/test/test_debug.py
--- a/rpython/rlib/test/test_debug.py
+++ b/rpython/rlib/test/test_debug.py
@@ -53,6 +53,15 @@
     py.test.raises(ListChangeUnallowed, interpret, f, [],
                    list_comprehension_operations=True)
 
+def test_make_sure_not_resized_annorder():
+    def f(n):
+        if n > 5:
+            result = None
+        else:
+            result = [1,2,3]
+        make_sure_not_resized(result)
+    interpret(f, [10])
+
 def test_mark_dict_non_null():
     def f():
         d = {"ac": "bx"}


More information about the pypy-commit mailing list