Issue #26822: itemgetter, attrgetter and methodcaller objects no longer
silently ignore keyword arguments.
diff --git a/Modules/operator.c b/Modules/operator.c
index 375592c..345c32e 100644
--- a/Modules/operator.c
+++ b/Modules/operator.c
@@ -511,6 +511,8 @@
PyObject *obj, *result;
Py_ssize_t i, nitems=ig->nitems;
+ if (!_PyArg_NoKeywords("itemgetter", kw))
+ return NULL;
if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &obj))
return NULL;
if (nitems == 1)
@@ -691,6 +693,8 @@
PyObject *obj, *result;
Py_ssize_t i, nattrs=ag->nattrs;
+ if (!_PyArg_NoKeywords("attrgetter", kw))
+ return NULL;
if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &obj))
return NULL;
if (ag->nattrs == 1)
@@ -838,6 +842,8 @@
{
PyObject *method, *obj, *result;
+ if (!_PyArg_NoKeywords("methodcaller", kw))
+ return NULL;
if (!PyArg_UnpackTuple(args, "methodcaller", 1, 1, &obj))
return NULL;
method = PyObject_GetAttr(obj, mc->name);