Skip to content

Commit 6cca5c8

Browse files
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.
1 parent 865de27 commit 6cca5c8

File tree

13 files changed

+23
-23
lines changed

13 files changed

+23
-23
lines changed

Modules/_operator.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ itemgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
949949
PyObject *item;
950950
Py_ssize_t nitems;
951951

952-
if (!_PyArg_NoKeywords("itemgetter()", kwds))
952+
if (!_PyArg_NoKeywords("itemgetter", kwds))
953953
return NULL;
954954

955955
nitems = PyTuple_GET_SIZE(args);
@@ -1124,7 +1124,7 @@ attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
11241124
PyObject *attr;
11251125
Py_ssize_t nattrs, idx, char_idx;
11261126

1127-
if (!_PyArg_NoKeywords("attrgetter()", kwds))
1127+
if (!_PyArg_NoKeywords("attrgetter", kwds))
11281128
return NULL;
11291129

11301130
nattrs = PyTuple_GET_SIZE(args);

Modules/_randommodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ random_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
435435
RandomObject *self;
436436
PyObject *tmp;
437437

438-
if (type == &Random_Type && !_PyArg_NoKeywords("Random()", kwds))
438+
if (type == &Random_Type && !_PyArg_NoKeywords("Random", kwds))
439439
return NULL;
440440

441441
self = (RandomObject *)type->tp_alloc(type, 0);

Modules/_sqlite/connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,7 @@ PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, Py
12181218
return NULL;
12191219
}
12201220

1221-
if (!_PyArg_NoKeywords(MODULE_NAME ".Connection()", kwargs))
1221+
if (!_PyArg_NoKeywords(MODULE_NAME ".Connection", kwargs))
12221222
return NULL;
12231223

12241224
if (!PyArg_ParseTuple(args, "O", &sql))

Modules/_sqlite/row.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pysqlite_row_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4141

4242
assert(type != NULL && type->tp_alloc != NULL);
4343

44-
if (!_PyArg_NoKeywords("Row()", kwargs))
44+
if (!_PyArg_NoKeywords("Row", kwargs))
4545
return NULL;
4646
if (!PyArg_ParseTuple(args, "OO", &cursor, &data))
4747
return NULL;

Modules/arraymodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2568,7 +2568,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
25682568
PyObject *initial = NULL, *it = NULL;
25692569
const struct arraydescr *descr;
25702570

2571-
if (type == &Arraytype && !_PyArg_NoKeywords("array.array()", kwds))
2571+
if (type == &Arraytype && !_PyArg_NoKeywords("array.array", kwds))
25722572
return NULL;
25732573

25742574
if (!PyArg_ParseTuple(args, "C|O:array", &c, &initial))

Modules/itertoolsmodule.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ cycle_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
871871
PyObject *saved;
872872
cycleobject *lz;
873873

874-
if (type == &cycle_type && !_PyArg_NoKeywords("cycle()", kwds))
874+
if (type == &cycle_type && !_PyArg_NoKeywords("cycle", kwds))
875875
return NULL;
876876

877877
if (!PyArg_UnpackTuple(args, "cycle", 1, 1, &iterable))
@@ -1072,7 +1072,7 @@ dropwhile_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
10721072
PyObject *it;
10731073
dropwhileobject *lz;
10741074

1075-
if (type == &dropwhile_type && !_PyArg_NoKeywords("dropwhile()", kwds))
1075+
if (type == &dropwhile_type && !_PyArg_NoKeywords("dropwhile", kwds))
10761076
return NULL;
10771077

10781078
if (!PyArg_UnpackTuple(args, "dropwhile", 2, 2, &func, &seq))
@@ -1240,7 +1240,7 @@ takewhile_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
12401240
PyObject *it;
12411241
takewhileobject *lz;
12421242

1243-
if (type == &takewhile_type && !_PyArg_NoKeywords("takewhile()", kwds))
1243+
if (type == &takewhile_type && !_PyArg_NoKeywords("takewhile", kwds))
12441244
return NULL;
12451245

12461246
if (!PyArg_UnpackTuple(args, "takewhile", 2, 2, &func, &seq))
@@ -1408,7 +1408,7 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
14081408
Py_ssize_t numargs;
14091409
isliceobject *lz;
14101410

1411-
if (type == &islice_type && !_PyArg_NoKeywords("islice()", kwds))
1411+
if (type == &islice_type && !_PyArg_NoKeywords("islice", kwds))
14121412
return NULL;
14131413

14141414
if (!PyArg_UnpackTuple(args, "islice", 2, 4, &seq, &a1, &a2, &a3))
@@ -1662,7 +1662,7 @@ starmap_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
16621662
PyObject *it;
16631663
starmapobject *lz;
16641664

1665-
if (type == &starmap_type && !_PyArg_NoKeywords("starmap()", kwds))
1665+
if (type == &starmap_type && !_PyArg_NoKeywords("starmap", kwds))
16661666
return NULL;
16671667

16681668
if (!PyArg_UnpackTuple(args, "starmap", 2, 2, &func, &seq))
@@ -1820,7 +1820,7 @@ chain_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
18201820
{
18211821
PyObject *source;
18221822

1823-
if (type == &chain_type && !_PyArg_NoKeywords("chain()", kwds))
1823+
if (type == &chain_type && !_PyArg_NoKeywords("chain", kwds))
18241824
return NULL;
18251825

18261826
source = PyObject_GetIter(args);
@@ -3769,7 +3769,7 @@ filterfalse_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
37693769
filterfalseobject *lz;
37703770

37713771
if (type == &filterfalse_type &&
3772-
!_PyArg_NoKeywords("filterfalse()", kwds))
3772+
!_PyArg_NoKeywords("filterfalse", kwds))
37733773
return NULL;
37743774

37753775
if (!PyArg_UnpackTuple(args, "filterfalse", 2, 2, &func, &seq))

Modules/zipimport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds)
6969
PyObject *filename = NULL;
7070
Py_ssize_t len, flen;
7171

72-
if (!_PyArg_NoKeywords("zipimporter()", kwds))
72+
if (!_PyArg_NoKeywords("zipimporter", kwds))
7373
return -1;
7474

7575
if (!PyArg_ParseTuple(args, "O&:zipimporter",

Objects/boolobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bool_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
4545
PyObject *x = Py_False;
4646
long ok;
4747

48-
if (!_PyArg_NoKeywords("bool()", kwds))
48+
if (!_PyArg_NoKeywords("bool", kwds))
4949
return NULL;
5050
if (!PyArg_UnpackTuple(args, "bool", 0, 1, &x))
5151
return NULL;

Objects/rangeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw)
7474
rangeobject *obj;
7575
PyObject *start = NULL, *stop = NULL, *step = NULL;
7676

77-
if (!_PyArg_NoKeywords("range()", kw))
77+
if (!_PyArg_NoKeywords("range", kw))
7878
return NULL;
7979

8080
if (PyTuple_Size(args) <= 1) {

Objects/setobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ frozenset_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
10831083
{
10841084
PyObject *iterable = NULL, *result;
10851085

1086-
if (type == &PyFrozenSet_Type && !_PyArg_NoKeywords("frozenset()", kwds))
1086+
if (type == &PyFrozenSet_Type && !_PyArg_NoKeywords("frozenset", kwds))
10871087
return NULL;
10881088

10891089
if (!PyArg_UnpackTuple(args, type->tp_name, 0, 1, &iterable))
@@ -2006,7 +2006,7 @@ set_init(PySetObject *self, PyObject *args, PyObject *kwds)
20062006
{
20072007
PyObject *iterable = NULL;
20082008

2009-
if (!_PyArg_NoKeywords("set()", kwds))
2009+
if (!_PyArg_NoKeywords("set", kwds))
20102010
return -1;
20112011
if (!PyArg_UnpackTuple(args, Py_TYPE(self)->tp_name, 0, 1, &iterable))
20122012
return -1;

Objects/sliceobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ slice_new(PyTypeObject *type, PyObject *args, PyObject *kw)
297297

298298
start = stop = step = NULL;
299299

300-
if (!_PyArg_NoKeywords("slice()", kw))
300+
if (!_PyArg_NoKeywords("slice", kw))
301301
return NULL;
302302

303303
if (!PyArg_UnpackTuple(args, "slice", 1, 3, &start, &stop, &step))

Objects/weakrefobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ weakref___init__(PyObject *self, PyObject *args, PyObject *kwargs)
332332
{
333333
PyObject *tmp;
334334

335-
if (!_PyArg_NoKeywords("ref()", kwargs))
335+
if (!_PyArg_NoKeywords("ref", kwargs))
336336
return -1;
337337

338338
if (parse_weakref_init_args("__init__", args, kwargs, &tmp, &tmp))

Python/bltinmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ filter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
429429
PyObject *it;
430430
filterobject *lz;
431431

432-
if (type == &PyFilter_Type && !_PyArg_NoKeywords("filter()", kwds))
432+
if (type == &PyFilter_Type && !_PyArg_NoKeywords("filter", kwds))
433433
return NULL;
434434

435435
if (!PyArg_UnpackTuple(args, "filter", 2, 2, &func, &seq))
@@ -1125,7 +1125,7 @@ map_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
11251125
mapobject *lz;
11261126
Py_ssize_t numargs, i;
11271127

1128-
if (type == &PyMap_Type && !_PyArg_NoKeywords("map()", kwds))
1128+
if (type == &PyMap_Type && !_PyArg_NoKeywords("map", kwds))
11291129
return NULL;
11301130

11311131
numargs = PyTuple_Size(args);
@@ -2446,7 +2446,7 @@ zip_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
24462446
PyObject *result;
24472447
Py_ssize_t tuplesize;
24482448

2449-
if (type == &PyZip_Type && !_PyArg_NoKeywords("zip()", kwds))
2449+
if (type == &PyZip_Type && !_PyArg_NoKeywords("zip", kwds))
24502450
return NULL;
24512451

24522452
/* args must be a tuple */

0 commit comments

Comments
 (0)