mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Update ga_new to use _PyArg_CheckPositional and _PyArg_NoKwnames (GH-19679)
This commit is contained in:
parent
ebebb6429c
commit
02e4484f19
1 changed files with 2 additions and 4 deletions
|
@ -438,12 +438,10 @@ static PyGetSetDef ga_properties[] = {
|
||||||
static PyObject *
|
static PyObject *
|
||||||
ga_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
ga_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
if (kwds != NULL && PyDict_GET_SIZE(kwds) != 0) {
|
if (!_PyArg_NoKwnames("GenericAlias", kwds)) {
|
||||||
PyErr_SetString(PyExc_TypeError, "GenericAlias does not support keyword arguments");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (PyTuple_GET_SIZE(args) != 2) {
|
if (!_PyArg_CheckPositional("GenericAlias", PyTuple_GET_SIZE(args), 2, 2)) {
|
||||||
PyErr_SetString(PyExc_TypeError, "GenericAlias expects 2 positional arguments");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
PyObject *origin = PyTuple_GET_ITEM(args, 0);
|
PyObject *origin = PyTuple_GET_ITEM(args, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue