summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2020-04-23 16:25:53 (GMT)
committerGitHub <noreply@github.com>2020-04-23 16:25:53 (GMT)
commit02e4484f19304a0a5f484f06a3fa441c6fb6073a (patch)
tree948ec57fe0f3775536f44d1d44be7c535fc6b41c /Objects
parentebebb6429c224c713e1c63a0b05d4840f52c7415 (diff)
downloadcpython-02e4484f19304a0a5f484f06a3fa441c6fb6073a.zip
cpython-02e4484f19304a0a5f484f06a3fa441c6fb6073a.tar.gz
cpython-02e4484f19304a0a5f484f06a3fa441c6fb6073a.tar.bz2
Update ga_new to use _PyArg_CheckPositional and _PyArg_NoKwnames (GH-19679)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/genericaliasobject.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index b8ad4d7..a56bdda 100644
--- a/Objects/genericaliasobject.c
+++ b/Objects/genericaliasobject.c
@@ -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);