Skip to content

Commit ba55263

Browse files
committed
make [posix,nt].ScandirIterator immutable
1 parent 2b0f8ef commit ba55263

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

Modules/posixmodule.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16477,14 +16477,17 @@ static PyType_Slot ScandirIteratorType_slots[] = {
1647716477
};
1647816478

1647916479
static PyType_Spec ScandirIteratorType_spec = {
16480-
MODNAME ".ScandirIterator",
16481-
sizeof(ScandirIterator),
16482-
0,
16480+
.name = MODNAME ".ScandirIterator",
16481+
.basicsize = sizeof(ScandirIterator),
1648316482
// bpo-40549: Py_TPFLAGS_BASETYPE should not be used, since
1648416483
// PyType_GetModule(Py_TYPE(self)) doesn't work on a subclass instance.
16485-
(Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_FINALIZE
16486-
| Py_TPFLAGS_DISALLOW_INSTANTIATION),
16487-
ScandirIteratorType_slots
16484+
.flags = (
16485+
Py_TPFLAGS_DEFAULT
16486+
| Py_TPFLAGS_HAVE_FINALIZE
16487+
| Py_TPFLAGS_DISALLOW_INSTANTIATION
16488+
| Py_TPFLAGS_IMMUTABLETYPE
16489+
),
16490+
.slots = ScandirIteratorType_slots
1648816491
};
1648916492

1649016493
/*[clinic input]

0 commit comments

Comments
 (0)