mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Disallow keyword arguments for type constructors that don't use them.
(fixes bug #1119418)
This commit is contained in:
parent
bd77da6dab
commit
02c42871cf
13 changed files with 100 additions and 13 deletions
|
|
@ -269,6 +269,9 @@ itemgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
PyObject *item;
|
||||
int nitems;
|
||||
|
||||
if (!_PyArg_NoKeywords("itemgetter()", kwds))
|
||||
return NULL;
|
||||
|
||||
nitems = PyTuple_GET_SIZE(args);
|
||||
if (nitems <= 1) {
|
||||
if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &item))
|
||||
|
|
@ -405,6 +408,9 @@ attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
PyObject *attr;
|
||||
int nattrs;
|
||||
|
||||
if (!_PyArg_NoKeywords("attrgetter()", kwds))
|
||||
return NULL;
|
||||
|
||||
nattrs = PyTuple_GET_SIZE(args);
|
||||
if (nattrs <= 1) {
|
||||
if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &attr))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue