Skip to content

Commit e937984

Browse files
Make chain and repeat immutable
1 parent da57b52 commit e937984

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Modules/itertoolsmodule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,7 +2206,8 @@ static PyType_Slot chain_slots[] = {
22062206
static PyType_Spec chain_spec = {
22072207
.name = "itertools.chain",
22082208
.basicsize = sizeof(chainobject),
2209-
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
2209+
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE |
2210+
Py_TPFLAGS_IMMUTABLETYPE),
22102211
.slots = chain_slots,
22112212
};
22122213

@@ -4316,7 +4317,8 @@ static PyType_Slot repeat_slots[] = {
43164317
static PyType_Spec repeat_spec = {
43174318
.name = "itertools.repeat",
43184319
.basicsize = sizeof(repeatobject),
4319-
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
4320+
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE |
4321+
Py_TPFLAGS_IMMUTABLETYPE),
43204322
.slots = repeat_slots,
43214323
};
43224324

0 commit comments

Comments
 (0)