mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Make staticmethod and classmethod complain about keyword args.
This commit is contained in:
parent
7d42d3cd59
commit
d02db4084e
1 changed files with 4 additions and 0 deletions
|
@ -686,6 +686,8 @@ cm_init(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &callable))
|
if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &callable))
|
||||||
return -1;
|
return -1;
|
||||||
|
if (!_PyArg_NoKeywords("classmethod", kwds))
|
||||||
|
return -1;
|
||||||
if (!PyCallable_Check(callable)) {
|
if (!PyCallable_Check(callable)) {
|
||||||
PyErr_Format(PyExc_TypeError, "'%s' object is not callable",
|
PyErr_Format(PyExc_TypeError, "'%s' object is not callable",
|
||||||
callable->ob_type->tp_name);
|
callable->ob_type->tp_name);
|
||||||
|
@ -842,6 +844,8 @@ sm_init(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "staticmethod", 1, 1, &callable))
|
if (!PyArg_UnpackTuple(args, "staticmethod", 1, 1, &callable))
|
||||||
return -1;
|
return -1;
|
||||||
|
if (!_PyArg_NoKeywords("staticmethod", kwds))
|
||||||
|
return -1;
|
||||||
Py_INCREF(callable);
|
Py_INCREF(callable);
|
||||||
sm->sm_callable = callable;
|
sm->sm_callable = callable;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue