Issue #29460: _PyArg_NoKeywords(), _PyArg_NoStackKeywords() and
_PyArg_NoPositional() now are macros.
This commit is contained in:
parent
6aee6fbce8
commit
68a001dd59
|
@ -62,6 +62,13 @@ PyAPI_FUNC(int) _PyArg_UnpackStack(
|
|||
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);
|
||||
|
|
|
@ -993,7 +993,7 @@ itemgetter_call(itemgetterobject *ig, PyObject *args, PyObject *kw)
|
|||
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;
|
||||
|
@ -1283,7 +1283,7 @@ attrgetter_call(attrgetterobject *ag, PyObject *args, PyObject *kw)
|
|||
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;
|
||||
|
@ -1527,7 +1527,7 @@ methodcaller_call(methodcallerobject *mc, PyObject *args, PyObject *kw)
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -1084,8 +1084,7 @@ frozenset_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
{
|
||||
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))
|
||||
|
@ -2002,7 +2001,7 @@ set_init(PySetObject *self, PyObject *args, PyObject *kwds)
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -2446,6 +2446,10 @@ _PyArg_UnpackStack(PyObject **args, Py_ssize_t nargs, const char *name,
|
|||
}
|
||||
|
||||
|
||||
#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
|
||||
|
|
Loading…
Reference in New Issue