Skip to content

Commit 7823271

Browse files
author
Erlend E. Aasland
committed
bpo-43908: Apply Py_TPFLAGS_IMMUTABLETYPE to re types
1 parent 103d5e4 commit 7823271

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/_sre.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2690,7 +2690,7 @@ static PyType_Spec pattern_spec = {
26902690
.name = "re.Pattern",
26912691
.basicsize = sizeof(PatternObject),
26922692
.itemsize = sizeof(SRE_CODE),
2693-
.flags = Py_TPFLAGS_DEFAULT,
2693+
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
26942694
.slots = pattern_slots,
26952695
};
26962696

@@ -2755,7 +2755,7 @@ static PyType_Spec match_spec = {
27552755
.name = "re.Match",
27562756
.basicsize = sizeof(MatchObject),
27572757
.itemsize = sizeof(Py_ssize_t),
2758-
.flags = Py_TPFLAGS_DEFAULT,
2758+
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
27592759
.slots = match_slots,
27602760
};
27612761

@@ -2781,7 +2781,7 @@ static PyType_Slot scanner_slots[] = {
27812781
static PyType_Spec scanner_spec = {
27822782
.name = "_" SRE_MODULE ".SRE_Scanner",
27832783
.basicsize = sizeof(ScannerObject),
2784-
.flags = Py_TPFLAGS_DEFAULT,
2784+
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
27852785
.slots = scanner_slots,
27862786
};
27872787

0 commit comments

Comments
 (0)