summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_array.py
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-04-30 14:04:57 (GMT)
committerGitHub <noreply@github.com>2021-04-30 14:04:57 (GMT)
commit9746cda705decebc0ba572d95612796afd06dcd4 (patch)
treed21d7082061099687919b8e744250bb39cf5613d /Lib/test/test_array.py
parent387397f8a4244c983f4568c16a28842e3268fe5d (diff)
downloadcpython-9746cda705decebc0ba572d95612796afd06dcd4.zip
cpython-9746cda705decebc0ba572d95612796afd06dcd4.tar.gz
cpython-9746cda705decebc0ba572d95612796afd06dcd4.tar.bz2
bpo-43916: Apply Py_TPFLAGS_DISALLOW_INSTANTIATION to selected types (GH-25748)
Apply Py_TPFLAGS_DISALLOW_INSTANTIATION to the following types: * _dbm.dbm * _gdbm.gdbm * _multibytecodec.MultibyteCodec * _sre..SRE_Scanner * _thread._localdummy * _thread.lock * _winapi.Overlapped * array.arrayiterator * functools.KeyWrapper * functools._lru_list_elem * pyexpat.xmlparser * re.Match * re.Pattern * unicodedata.UCD * zlib.Compress * zlib.Decompress
Diffstat (limited to 'Lib/test/test_array.py')
-rw-r--r--Lib/test/test_array.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 11184ad..b18467f 100644
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -41,6 +41,12 @@ class MiscTest(unittest.TestCase):
self.assertRaises(ValueError, array.array, 'x')
@support.cpython_only
+ def test_disallow_instantiation(self):
+ # Ensure that the type disallows instantiation (bpo-43916)
+ tp = type(iter(array.array('I')))
+ self.assertRaises(TypeError, tp)
+
+ @support.cpython_only
def test_immutable(self):
# bpo-43908: check that array.array is immutable
with self.assertRaises(TypeError):