diff options
| author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-04-30 14:04:57 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-30 14:04:57 (GMT) |
| commit | 9746cda705decebc0ba572d95612796afd06dcd4 (patch) | |
| tree | d21d7082061099687919b8e744250bb39cf5613d /Lib/test/test_dbm_gnu.py | |
| parent | 387397f8a4244c983f4568c16a28842e3268fe5d (diff) | |
| download | cpython-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_dbm_gnu.py')
| -rw-r--r-- | Lib/test/test_dbm_gnu.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_dbm_gnu.py b/Lib/test/test_dbm_gnu.py index 017d0ff..b3e5572 100644 --- a/Lib/test/test_dbm_gnu.py +++ b/Lib/test/test_dbm_gnu.py @@ -1,5 +1,5 @@ from test import support -from test.support import import_helper +from test.support import import_helper, cpython_only gdbm = import_helper.import_module("dbm.gnu") #skip if not supported import unittest import os @@ -27,6 +27,13 @@ class TestGdbm(unittest.TestCase): self.g.close() unlink(filename) + @cpython_only + def test_disallow_instantiation(self): + # Ensure that the type disallows instantiation (bpo-43916) + self.g = gdbm.open(filename, 'c') + tp = type(self.g) + self.assertRaises(TypeError, tp) + def test_key_methods(self): self.g = gdbm.open(filename, 'c') self.assertEqual(self.g.keys(), []) |
