summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.c
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-04-29 06:47:11 (GMT)
committerGitHub <noreply@github.com>2021-04-29 06:47:11 (GMT)
commit5daf70b22e72ea1a88c05975f69120b8c4e4927f (patch)
treee9e661b7d671bb41f9ec9776f7d378288d187cf4 /Modules/_sre.c
parent1e7b858575d0ad782939f86aae4a2fa1c29e9f14 (diff)
downloadcpython-5daf70b22e72ea1a88c05975f69120b8c4e4927f.zip
cpython-5daf70b22e72ea1a88c05975f69120b8c4e4927f.tar.gz
cpython-5daf70b22e72ea1a88c05975f69120b8c4e4927f.tar.bz2
bpo-43908: Make re types immutable (GH-25697)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r--Modules/_sre.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index d4bfff6..59f7551 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -2690,7 +2690,7 @@ static PyType_Spec pattern_spec = {
.name = "re.Pattern",
.basicsize = sizeof(PatternObject),
.itemsize = sizeof(SRE_CODE),
- .flags = Py_TPFLAGS_DEFAULT,
+ .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
.slots = pattern_slots,
};
@@ -2755,7 +2755,7 @@ static PyType_Spec match_spec = {
.name = "re.Match",
.basicsize = sizeof(MatchObject),
.itemsize = sizeof(Py_ssize_t),
- .flags = Py_TPFLAGS_DEFAULT,
+ .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
.slots = match_slots,
};
@@ -2781,7 +2781,7 @@ static PyType_Slot scanner_slots[] = {
static PyType_Spec scanner_spec = {
.name = "_" SRE_MODULE ".SRE_Scanner",
.basicsize = sizeof(ScannerObject),
- .flags = Py_TPFLAGS_DEFAULT,
+ .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
.slots = scanner_slots,
};