summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-04-23 07:53:43 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-04-23 07:53:43 (GMT)
commit745145a7dadd05713a9f927096bc977792d7484b (patch)
tree1337d0e150218c33f291fca0d1c831f6b5df767c /Modules
parent9046df065992c1763d92ed71882e3a45c8fb7437 (diff)
parentc2a2a751cf02f603c979817b0927b238ec0f141f (diff)
downloadcpython-745145a7dadd05713a9f927096bc977792d7484b.zip
cpython-745145a7dadd05713a9f927096bc977792d7484b.tar.gz
cpython-745145a7dadd05713a9f927096bc977792d7484b.tar.bz2
Issue #26822: itemgetter, attrgetter and methodcaller objects no longer
silently ignore keyword arguments.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_operator.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_operator.c b/Modules/_operator.c
index 735affc..2f1ee0e 100644
--- a/Modules/_operator.c
+++ b/Modules/_operator.c
@@ -460,6 +460,8 @@ itemgetter_call(itemgetterobject *ig, PyObject *args, PyObject *kw)
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)
@@ -747,6 +749,8 @@ attrgetter_call(attrgetterobject *ag, PyObject *args, PyObject *kw)
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) /* ag->attr is always a tuple */
@@ -988,6 +992,8 @@ methodcaller_call(methodcallerobject *mc, PyObject *args, PyObject *kw)
{
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);