bpo-30592: Fixed error messages for some builtins. (#1996)
Error messages when pass keyword arguments to some builtins that
don't support keyword arguments contained double parenthesis: "()()".
The regression was introduced by bpo-30534.
diff --git a/Objects/boolobject.c b/Objects/boolobject.c
index becdfcb..b92fafe 100644
--- a/Objects/boolobject.c
+++ b/Objects/boolobject.c
@@ -45,7 +45,7 @@
PyObject *x = Py_False;
long ok;
- if (!_PyArg_NoKeywords("bool()", kwds))
+ if (!_PyArg_NoKeywords("bool", kwds))
return NULL;
if (!PyArg_UnpackTuple(args, "bool", 0, 1, &x))
return NULL;
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 554528d..dd0e4be 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -74,7 +74,7 @@
rangeobject *obj;
PyObject *start = NULL, *stop = NULL, *step = NULL;
- if (!_PyArg_NoKeywords("range()", kw))
+ if (!_PyArg_NoKeywords("range", kw))
return NULL;
if (PyTuple_Size(args) <= 1) {
diff --git a/Objects/setobject.c b/Objects/setobject.c
index a9dba31..2347b9d 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -1083,7 +1083,7 @@
{
PyObject *iterable = NULL, *result;
- if (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))
@@ -2006,7 +2006,7 @@
{
PyObject *iterable = NULL;
- if (!_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;
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index 4263737..b5aabfd 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -297,7 +297,7 @@
start = stop = step = NULL;
- if (!_PyArg_NoKeywords("slice()", kw))
+ if (!_PyArg_NoKeywords("slice", kw))
return NULL;
if (!PyArg_UnpackTuple(args, "slice", 1, 3, &start, &stop, &step))
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index da05950..f600179 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -332,7 +332,7 @@
{
PyObject *tmp;
- if (!_PyArg_NoKeywords("ref()", kwargs))
+ if (!_PyArg_NoKeywords("ref", kwargs))
return -1;
if (parse_weakref_init_args("__init__", args, kwargs, &tmp, &tmp))