summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-04-29 06:12:25 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-04-29 06:12:25 (GMT)
commit54b60cf6286b5eeb38af9f3bb25381bb53c27ce1 (patch)
treea9953cf277e8ee6e8f90ad5d92ef9029784b239b /Modules
parenta5ffa2e965d421784944df291fd52788cf59c5df (diff)
parent6dfcde5e29876beb59e26929e222a514aa002cdd (diff)
downloadcpython-54b60cf6286b5eeb38af9f3bb25381bb53c27ce1.zip
cpython-54b60cf6286b5eeb38af9f3bb25381bb53c27ce1.tar.gz
cpython-54b60cf6286b5eeb38af9f3bb25381bb53c27ce1.tar.bz2
Issue #26822: Decreased an overhead of using _PyArg_NoKeywords() in calls of
itemgetter, attrgetter and methodcaller objects.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_operator.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_operator.c b/Modules/_operator.c
index 2f1ee0e..eb4f3a3 100644
--- a/Modules/_operator.c
+++ b/Modules/_operator.c
@@ -460,7 +460,7 @@ itemgetter_call(itemgetterobject *ig, PyObject *args, PyObject *kw)
PyObject *obj, *result;
Py_ssize_t i, nitems=ig->nitems;
- if (!_PyArg_NoKeywords("itemgetter", kw))
+ if (kw != NULL && !_PyArg_NoKeywords("itemgetter", kw))
return NULL;
if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &obj))
return NULL;
@@ -749,7 +749,7 @@ attrgetter_call(attrgetterobject *ag, PyObject *args, PyObject *kw)
PyObject *obj, *result;
Py_ssize_t i, nattrs=ag->nattrs;
- if (!_PyArg_NoKeywords("attrgetter", kw))
+ if (kw != NULL && !_PyArg_NoKeywords("attrgetter", kw))
return NULL;
if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &obj))
return NULL;
@@ -992,7 +992,7 @@ methodcaller_call(methodcallerobject *mc, PyObject *args, PyObject *kw)
{
PyObject *method, *obj, *result;
- if (!_PyArg_NoKeywords("methodcaller", kw))
+ if (kw != NULL && !_PyArg_NoKeywords("methodcaller", kw))
return NULL;
if (!PyArg_UnpackTuple(args, "methodcaller", 1, 1, &obj))
return NULL;