mirror of
https://github.com/python/cpython.git
synced 2025-10-06 23:21:06 +00:00
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
This commit is contained in:
parent
387397f8a4
commit
9746cda705
20 changed files with 87 additions and 28 deletions
|
@ -40,6 +40,12 @@ class MiscTest(unittest.TestCase):
|
|||
self.assertRaises(TypeError, array.array, 'xx')
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue