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

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,4 @@
Fix undefined behaviour in :class:`operator.methodcaller`: its
:c:member:`~PyTypeObject.tp_clear` slot function returned ``void`` instead of
``int``, so the garbage collector called it through an incompatible function
type. Patched by Shamil Abdulaev.
3 changes: 2 additions & 1 deletion Modules/_operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ methodcaller_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)mc;
}

static void
static int
methodcaller_clear(PyObject *op)
{
methodcallerobject *mc = methodcallerobject_CAST(op);
Expand All @@ -1749,6 +1749,7 @@ methodcaller_clear(PyObject *op)
Py_CLEAR(mc->kwds);
Py_CLEAR(mc->vectorcall_args);
Py_CLEAR(mc->vectorcall_kwnames);
return 0;
}

static void
Expand Down
Loading