_PyArg_NoPositional() now are macros.
PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs);
PyAPI_FUNC(int) _PyArg_NoStackKeywords(const char *funcname, PyObject *kwnames);
PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
+#define _PyArg_NoKeywords(funcname, kwargs) \
+ ((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs)))
+#define _PyArg_NoStackKeywords(funcname, kwnames) \
+ ((kwnames) == NULL || _PyArg_NoStackKeywords((funcname), (kwnames)))
+#define _PyArg_NoPositional(funcname, args) \
+ ((args) == NULL || _PyArg_NoPositional((funcname), (args)))
+
#endif
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
PyObject *obj, *result;
Py_ssize_t i, nitems=ig->nitems;
- if (kw != NULL && !_PyArg_NoKeywords("itemgetter", kw))
+ if (!_PyArg_NoKeywords("itemgetter", kw))
return NULL;
if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &obj))
return NULL;
PyObject *obj, *result;
Py_ssize_t i, nattrs=ag->nattrs;
- if (kw != NULL && !_PyArg_NoKeywords("attrgetter", kw))
+ if (!_PyArg_NoKeywords("attrgetter", kw))
return NULL;
if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &obj))
return NULL;
{
PyObject *method, *obj, *result;
- if (kw != NULL && !_PyArg_NoKeywords("methodcaller", kw))
+ if (!_PyArg_NoKeywords("methodcaller", kw))
return NULL;
if (!PyArg_UnpackTuple(args, "methodcaller", 1, 1, &obj))
return NULL;
{
PyObject *iterable = NULL, *result;
- if (kwds != NULL && type == &PyFrozenSet_Type
- && !_PyArg_NoKeywords("frozenset()", kwds))
+ if (type == &PyFrozenSet_Type && !_PyArg_NoKeywords("frozenset()", kwds))
return NULL;
if (!PyArg_UnpackTuple(args, type->tp_name, 0, 1, &iterable))
{
PyObject *iterable = NULL;
- if (kwds != NULL && !_PyArg_NoKeywords("set()", kwds))
+ if (!_PyArg_NoKeywords("set()", kwds))
return -1;
if (!PyArg_UnpackTuple(args, Py_TYPE(self)->tp_name, 0, 1, &iterable))
return -1;
}
+#undef _PyArg_NoKeywords
+#undef _PyArg_NoStackKeywords
+#undef _PyArg_NoPositional
+
/* For type constructors that don't take keyword args
*
* Sets a TypeError and returns 0 if the args/kwargs is