mirror of https://github.com/python/cpython
Issue #29289: Argument Clinic generates reasonable name for the parameter "default".
This commit is contained in:
parent
48088ee9ba
commit
a70eaf21e3
|
@ -46,7 +46,7 @@ PyDoc_STRVAR(OrderedDict_setdefault__doc__,
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
||||||
PyObject *failobj);
|
PyObject *default_value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
OrderedDict_setdefault(PyODictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
OrderedDict_setdefault(PyODictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
@ -55,13 +55,13 @@ OrderedDict_setdefault(PyODictObject *self, PyObject **args, Py_ssize_t nargs, P
|
||||||
static const char * const _keywords[] = {"key", "default", NULL};
|
static const char * const _keywords[] = {"key", "default", NULL};
|
||||||
static _PyArg_Parser _parser = {"O|O:setdefault", _keywords, 0};
|
static _PyArg_Parser _parser = {"O|O:setdefault", _keywords, 0};
|
||||||
PyObject *key;
|
PyObject *key;
|
||||||
PyObject *failobj = Py_None;
|
PyObject *default_value = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&key, &failobj)) {
|
&key, &default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = OrderedDict_setdefault_impl(self, key, failobj);
|
return_value = OrderedDict_setdefault_impl(self, key, default_value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
|
@ -132,4 +132,4 @@ OrderedDict_move_to_end(PyODictObject *self, PyObject **args, Py_ssize_t nargs,
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=f2641e1277045b59 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=84ef19e7b5db0086 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -1012,15 +1012,15 @@ Done:
|
||||||
OrderedDict.setdefault
|
OrderedDict.setdefault
|
||||||
|
|
||||||
key: object
|
key: object
|
||||||
default as failobj: object = None
|
default: object = None
|
||||||
|
|
||||||
od.get(k,d), also set od[k]=d if k not in od.
|
od.get(k,d), also set od[k]=d if k not in od.
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
||||||
PyObject *failobj)
|
PyObject *default_value)
|
||||||
/*[clinic end generated code: output=605d0f6f61ccb0a6 input=4ee5006f32f5691b]*/
|
/*[clinic end generated code: output=97537cb7c28464b6 input=d5e940fcea7a5a67]*/
|
||||||
{
|
{
|
||||||
PyObject *result = NULL;
|
PyObject *result = NULL;
|
||||||
|
|
||||||
|
@ -1030,9 +1030,9 @@ OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
return NULL;
|
return NULL;
|
||||||
assert(_odict_find_node(self, key) == NULL);
|
assert(_odict_find_node(self, key) == NULL);
|
||||||
if (PyODict_SetItem((PyObject *)self, key, failobj) >= 0) {
|
if (PyODict_SetItem((PyObject *)self, key, default_value) >= 0) {
|
||||||
result = failobj;
|
result = default_value;
|
||||||
Py_INCREF(failobj);
|
Py_INCREF(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1047,9 +1047,9 @@ OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
||||||
else if (exists) {
|
else if (exists) {
|
||||||
result = PyObject_GetItem((PyObject *)self, key);
|
result = PyObject_GetItem((PyObject *)self, key);
|
||||||
}
|
}
|
||||||
else if (PyObject_SetItem((PyObject *)self, key, failobj) >= 0) {
|
else if (PyObject_SetItem((PyObject *)self, key, default_value) >= 0) {
|
||||||
result = failobj;
|
result = default_value;
|
||||||
Py_INCREF(failobj);
|
Py_INCREF(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue