bpo-43908: Make array.array type immutable (GH-25696)
Co-authored-by: Victor Stinner <vstinner@python.org>
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index bdcd125..11184ad 100644
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -40,6 +40,12 @@ def test_bad_constructor(self):
self.assertRaises(TypeError, array.array, 'xx')
self.assertRaises(ValueError, array.array, 'x')
+ @support.cpython_only
+ def test_immutable(self):
+ # bpo-43908: check that array.array is immutable
+ with self.assertRaises(TypeError):
+ array.array.foo = 1
+
def test_empty(self):
# Exercise code for handling zero-length arrays
a = array.array('B')