mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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.
This commit is contained in:
parent
865de27dd7
commit
6cca5c8459
13 changed files with 23 additions and 23 deletions
|
|
@ -45,7 +45,7 @@ bool_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
|||
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) {
|
||||
|
|
|
|||
|
|
@ -1083,7 +1083,7 @@ frozenset_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
{
|
||||
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 @@ set_init(PySetObject *self, PyObject *args, PyObject *kwds)
|
|||
{
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ slice_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
|||
|
||||
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))
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ weakref___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
{
|
||||
PyObject *tmp;
|
||||
|
||||
if (!_PyArg_NoKeywords("ref()", kwargs))
|
||||
if (!_PyArg_NoKeywords("ref", kwargs))
|
||||
return -1;
|
||||
|
||||
if (parse_weakref_init_args("__init__", args, kwargs, &tmp, &tmp))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue