Author: Greg Price <[email protected]>
Branch: signatures
Changeset: r59315:10e68c139d5f
Date: 2012-12-02 17:47 -0800
http://bitbucket.org/pypy/pypy/changeset/10e68c139d5f/
Log: Test list types in signatures are immutable
diff --git a/pypy/rlib/test/test_objectmodel.py
b/pypy/rlib/test/test_objectmodel.py
--- a/pypy/rlib/test/test_objectmodel.py
+++ b/pypy/rlib/test/test_objectmodel.py
@@ -574,6 +574,22 @@
def bad_for_body():
f('a')
+ @signature(returns=types.list(types.char()))
+ def ff():
+ return ['a']
+ @check_annotator_fails
+ def mutate_broader():
+ ff()[0] = 'abc'
+ @check_annotator_fails
+ def mutate_unrelated():
+ ff()[0] = 1
+ @check_annotator_fails
+ @signature(types.list(types.char()), returns=types.int())
+ def mutate_in_body(l):
+ l[0] = 'abc'
+ return len(l)
+
+
def getgraph(f, argtypes):
from pypy.translator.translator import TranslationContext, graphof
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit