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 *
|
||||
OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
||||
PyObject *failobj);
|
||||
PyObject *default_value);
|
||||
|
||||
static PyObject *
|
||||
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 _PyArg_Parser _parser = {"O|O:setdefault", _keywords, 0};
|
||||
PyObject *key;
|
||||
PyObject *failobj = Py_None;
|
||||
PyObject *default_value = Py_None;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&key, &failobj)) {
|
||||
&key, &default_value)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = OrderedDict_setdefault_impl(self, key, failobj);
|
||||
return_value = OrderedDict_setdefault_impl(self, key, default_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
|
@ -132,4 +132,4 @@ OrderedDict_move_to_end(PyODictObject *self, PyObject **args, Py_ssize_t nargs,
|
|||
exit:
|
||||
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
|
||||
|
||||
key: object
|
||||
default as failobj: object = None
|
||||
default: object = None
|
||||
|
||||
od.get(k,d), also set od[k]=d if k not in od.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
||||
PyObject *failobj)
|
||||
/*[clinic end generated code: output=605d0f6f61ccb0a6 input=4ee5006f32f5691b]*/
|
||||
PyObject *default_value)
|
||||
/*[clinic end generated code: output=97537cb7c28464b6 input=d5e940fcea7a5a67]*/
|
||||
{
|
||||
PyObject *result = NULL;
|
||||
|
||||
|
@ -1030,9 +1030,9 @@ OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
|||
if (PyErr_Occurred())
|
||||
return NULL;
|
||||
assert(_odict_find_node(self, key) == NULL);
|
||||
if (PyODict_SetItem((PyObject *)self, key, failobj) >= 0) {
|
||||
result = failobj;
|
||||
Py_INCREF(failobj);
|
||||
if (PyODict_SetItem((PyObject *)self, key, default_value) >= 0) {
|
||||
result = default_value;
|
||||
Py_INCREF(result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1047,9 +1047,9 @@ OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
|||
else if (exists) {
|
||||
result = PyObject_GetItem((PyObject *)self, key);
|
||||
}
|
||||
else if (PyObject_SetItem((PyObject *)self, key, failobj) >= 0) {
|
||||
result = failobj;
|
||||
Py_INCREF(failobj);
|
||||
else if (PyObject_SetItem((PyObject *)self, key, default_value) >= 0) {
|
||||
result = default_value;
|
||||
Py_INCREF(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue