mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
bpo-30878: Fix error message when keyword arguments are passed (#2635)
to staticmethod() and classmethod().
This commit is contained in:
parent
aa6a4d6ed8
commit
9648088e6c
2 changed files with 12 additions and 4 deletions
|
@ -702,10 +702,10 @@ cm_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
classmethod *cm = (classmethod *)self;
|
||||
PyObject *callable;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &callable))
|
||||
return -1;
|
||||
if (!_PyArg_NoKeywords("classmethod", kwds))
|
||||
return -1;
|
||||
if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &callable))
|
||||
return -1;
|
||||
Py_INCREF(callable);
|
||||
cm->cm_callable = callable;
|
||||
return 0;
|
||||
|
@ -883,10 +883,10 @@ sm_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
staticmethod *sm = (staticmethod *)self;
|
||||
PyObject *callable;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "staticmethod", 1, 1, &callable))
|
||||
return -1;
|
||||
if (!_PyArg_NoKeywords("staticmethod", kwds))
|
||||
return -1;
|
||||
if (!PyArg_UnpackTuple(args, "staticmethod", 1, 1, &callable))
|
||||
return -1;
|
||||
Py_INCREF(callable);
|
||||
sm->sm_callable = callable;
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue