Commits

Armin Rigo committed 0d8ec01

Fix the case of lltype.FixedSizeArray.

Comments (0)

Files changed (2)

pypy/rpython/lltypesystem/lltype.py

             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:

pypy/rpython/lltypesystem/test/test_lltype.py

         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')