mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-43908: Make re types immutable (GH-25697)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
1e7b858575
commit
5daf70b22e
3 changed files with 17 additions and 3 deletions
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue