Skip to content

Commit

Permalink
Update ga_new to use _PyArg_CheckPositional and _PyArg_NoKwnames (pyt…
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 authored Apr 23, 2020
1 parent ebebb64 commit 02e4484
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Objects/genericaliasobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,10 @@ static PyGetSetDef ga_properties[] = {
static PyObject *
ga_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
if (kwds != NULL && PyDict_GET_SIZE(kwds) != 0) {
PyErr_SetString(PyExc_TypeError, "GenericAlias does not support keyword arguments");
if (!_PyArg_NoKwnames("GenericAlias", kwds)) {
return NULL;
}
if (PyTuple_GET_SIZE(args) != 2) {
PyErr_SetString(PyExc_TypeError, "GenericAlias expects 2 positional arguments");
if (!_PyArg_CheckPositional("GenericAlias", PyTuple_GET_SIZE(args), 2, 2)) {
return NULL;
}
PyObject *origin = PyTuple_GET_ITEM(args, 0);
Expand Down

0 comments on commit 02e4484

Please sign in to comment.