Author: Armin Rigo <[email protected]>
Branch: array-overallocation-in-nursery
Changeset: r67499:af232e633fbd
Date: 2013-10-22 12:06 +0200
http://bitbucket.org/pypy/pypy/changeset/af232e633fbd/

Log:    Check that we cannot use len() on overallocated arrays

diff --git a/rpython/rtyper/test/test_llann.py 
b/rpython/rtyper/test/test_llann.py
--- a/rpython/rtyper/test/test_llann.py
+++ b/rpython/rtyper/test/test_llann.py
@@ -404,6 +404,14 @@
         s = self.annotate(llf, [])
         assert s.is_constant() and s.const == 12
 
+    def test_cannot_use_len_on_overallocated_array(self):
+        A = GcArray(Signed, hints={'overallocated': True})
+        def llf():
+            a = malloc(A, 10)
+            return len(a)
+        e = py.test.raises(TypeError, self.annotate, llf, [])
+        assert str(e.value).endswith('has no length attribute')
+
 
 def test_pseudohighlevelcallable():
     t = TranslationContext()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to