Issue #26822: Decreased an overhead of using _PyArg_NoKeywords() in calls of
itemgetter, attrgetter and methodcaller objects.
diff --git a/Modules/operator.c b/Modules/operator.c
index 345c32e..ae060b8 100644
--- a/Modules/operator.c
+++ b/Modules/operator.c
@@ -511,7 +511,7 @@
     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;
@@ -693,7 +693,7 @@
     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;
@@ -842,7 +842,7 @@
 {
     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;