diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2018-09-12 17:54:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-12 17:54:06 (GMT) |
commit | 9dfa0fe587eae3626ffc973680c6a17f35de3864 (patch) | |
tree | b9bcea3d12dd609b45aafd333d72a8c05f5d053b /Python/clinic/bltinmodule.c.h | |
parent | 0fb9fadd3b3e9e3698647e0b92d49b0b7aacd979 (diff) | |
download | cpython-9dfa0fe587eae3626ffc973680c6a17f35de3864.zip cpython-9dfa0fe587eae3626ffc973680c6a17f35de3864.tar.gz cpython-9dfa0fe587eae3626ffc973680c6a17f35de3864.tar.bz2 |
bpo-34637: Make the *start* argument for *sum()* visible as a keyword argument. (GH-9208)
Diffstat (limited to 'Python/clinic/bltinmodule.c.h')
-rw-r--r-- | Python/clinic/bltinmodule.c.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h index 285caf9..121bbd4 100644 --- a/Python/clinic/bltinmodule.c.h +++ b/Python/clinic/bltinmodule.c.h @@ -608,7 +608,7 @@ exit: } PyDoc_STRVAR(builtin_sum__doc__, -"sum($module, iterable, start=0, /)\n" +"sum($module, iterable, /, start=0)\n" "--\n" "\n" "Return the sum of a \'start\' value (default: 0) plus an iterable of numbers\n" @@ -618,20 +618,21 @@ PyDoc_STRVAR(builtin_sum__doc__, "reject non-numeric types."); #define BUILTIN_SUM_METHODDEF \ - {"sum", (PyCFunction)builtin_sum, METH_FASTCALL, builtin_sum__doc__}, + {"sum", (PyCFunction)builtin_sum, METH_FASTCALL|METH_KEYWORDS, builtin_sum__doc__}, static PyObject * builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start); static PyObject * -builtin_sum(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +builtin_sum(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; + static const char * const _keywords[] = {"", "start", NULL}; + static _PyArg_Parser _parser = {"O|O:sum", _keywords, 0}; PyObject *iterable; PyObject *start = NULL; - if (!_PyArg_UnpackStack(args, nargs, "sum", - 1, 2, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &iterable, &start)) { goto exit; } @@ -710,4 +711,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs) exit: return return_value; } -/*[clinic end generated code: output=9f17c7a87d740374 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=eb6d08a32e7c83b6 input=a9049054013a1b77]*/ |