Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The types of :func:`select.poll` and :func:`select.epoll` objects are now
immutable. Patch by Bénédikt Tran.
17 changes: 10 additions & 7 deletions Modules/selectmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist,

typedef struct {
PyObject_HEAD
PyObject *dict;
PyObject *dict; // cannot create cycles as it only contains exact ints
int ufd_uptodate;
int ufd_len;
struct pollfd *ufds;
Expand Down Expand Up @@ -2483,7 +2483,11 @@ static PyType_Slot poll_Type_slots[] = {
static PyType_Spec poll_Type_spec = {
.name = "select.poll",
.basicsize = sizeof(pollObject),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
.flags = (
Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_DISALLOW_INSTANTIATION
| Py_TPFLAGS_IMMUTABLETYPE
),
.slots = poll_Type_slots,
};

Expand Down Expand Up @@ -2529,11 +2533,10 @@ static PyType_Slot pyEpoll_Type_slots[] = {
};

static PyType_Spec pyEpoll_Type_spec = {
"select.epoll",
sizeof(pyEpoll_Object),
0,
Py_TPFLAGS_DEFAULT,
pyEpoll_Type_slots
.name = "select.epoll",
.basicsize = sizeof(pyEpoll_Object),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
.slots = pyEpoll_Type_slots
};

#endif /* HAVE_EPOLL */
Expand Down
Loading