summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.c
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 /Modules/_sre.c
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 'Modules/_sre.c')
-rw-r--r--Modules/_sre.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 59f7551..9d0fc4a 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -2690,7 +2690,8 @@ static PyType_Spec pattern_spec = {
.name = "re.Pattern",
.basicsize = sizeof(PatternObject),
.itemsize = sizeof(SRE_CODE),
- .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE |
+ Py_TPFLAGS_DISALLOW_INSTANTIATION),
.slots = pattern_slots,
};
@@ -2755,7 +2756,8 @@ static PyType_Spec match_spec = {
.name = "re.Match",
.basicsize = sizeof(MatchObject),
.itemsize = sizeof(Py_ssize_t),
- .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE |
+ Py_TPFLAGS_DISALLOW_INSTANTIATION),
.slots = match_slots,
};
@@ -2781,7 +2783,8 @@ static PyType_Slot scanner_slots[] = {
static PyType_Spec scanner_spec = {
.name = "_" SRE_MODULE ".SRE_Scanner",
.basicsize = sizeof(ScannerObject),
- .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE |
+ Py_TPFLAGS_DISALLOW_INSTANTIATION),
.slots = scanner_slots,
};