Author: Armin Rigo <[email protected]>
Branch: stm
Changeset: r51973:0d8ec011d011
Date: 2012-01-30 21:27 +0100
http://bitbucket.org/pypy/pypy/changeset/0d8ec011d011/

Log:    Fix the case of lltype.FixedSizeArray.

diff --git a/pypy/rpython/lltypesystem/lltype.py 
b/pypy/rpython/lltypesystem/lltype.py
--- a/pypy/rpython/lltypesystem/lltype.py
+++ b/pypy/rpython/lltypesystem/lltype.py
@@ -355,10 +355,10 @@
             n = 1
         return _struct(self, n, initialization='example')
 
-    def _immutable_field(self, field):
+    def _immutable_field(self, field=None):
         if self._hints.get('immutable'):
             return True
-        if 'immutable_fields' in self._hints:
+        if field is not None and 'immutable_fields' in self._hints:
             try:
                 return self._hints['immutable_fields']._fields[field]
             except KeyError:
diff --git a/pypy/rpython/lltypesystem/test/test_lltype.py 
b/pypy/rpython/lltypesystem/test/test_lltype.py
--- a/pypy/rpython/lltypesystem/test/test_lltype.py
+++ b/pypy/rpython/lltypesystem/test/test_lltype.py
@@ -840,6 +840,12 @@
         immut = A._immutable_interiorfield([4, 'a'])
         assert immut == expected
 
+def test_immutable_fixedsizearray():
+    A = lltype.FixedSizeArray(lltype.Signed, 5)
+    assert not A._immutable_field()
+    A = lltype.FixedSizeArray(lltype.Signed, 5, hints={'immutable': True})
+    assert A._immutable_field()
+
 
 def test_typedef():
     T = Typedef(Signed, 'T')
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to