mirror of https://github.com/python/cpython
Issue #29311: Argument Clinic generates reasonable name for the parameter "default".
This commit is contained in:
parent
41baebd8b9
commit
48088ee9ba
|
@ -55,25 +55,25 @@ PyDoc_STRVAR(dict_get__doc__,
|
|||
{"get", (PyCFunction)dict_get, METH_FASTCALL, dict_get__doc__},
|
||||
|
||||
static PyObject *
|
||||
dict_get_impl(PyDictObject *self, PyObject *key, PyObject *failobj);
|
||||
dict_get_impl(PyDictObject *self, PyObject *key, PyObject *default_value);
|
||||
|
||||
static PyObject *
|
||||
dict_get(PyDictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *key;
|
||||
PyObject *failobj = Py_None;
|
||||
PyObject *default_value = Py_None;
|
||||
|
||||
if (!_PyArg_UnpackStack(args, nargs, "get",
|
||||
1, 2,
|
||||
&key, &failobj)) {
|
||||
&key, &default_value)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("get", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = dict_get_impl(self, key, failobj);
|
||||
return_value = dict_get_impl(self, key, default_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
|
@ -89,27 +89,28 @@ PyDoc_STRVAR(dict_setdefault__doc__,
|
|||
{"setdefault", (PyCFunction)dict_setdefault, METH_FASTCALL, dict_setdefault__doc__},
|
||||
|
||||
static PyObject *
|
||||
dict_setdefault_impl(PyDictObject *self, PyObject *key, PyObject *defaultobj);
|
||||
dict_setdefault_impl(PyDictObject *self, PyObject *key,
|
||||
PyObject *default_value);
|
||||
|
||||
static PyObject *
|
||||
dict_setdefault(PyDictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *key;
|
||||
PyObject *defaultobj = Py_None;
|
||||
PyObject *default_value = Py_None;
|
||||
|
||||
if (!_PyArg_UnpackStack(args, nargs, "setdefault",
|
||||
1, 2,
|
||||
&key, &defaultobj)) {
|
||||
&key, &default_value)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("setdefault", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = dict_setdefault_impl(self, key, defaultobj);
|
||||
return_value = dict_setdefault_impl(self, key, default_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=1b0cea84b4b6989e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=6e9d917602373072 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -2794,15 +2794,15 @@ dict___contains__(PyDictObject *self, PyObject *key)
|
|||
dict.get
|
||||
|
||||
key: object
|
||||
default as failobj: object = None
|
||||
default: object = None
|
||||
/
|
||||
|
||||
D.get(key[, default]) -> D[key] if key in D, else default.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
dict_get_impl(PyDictObject *self, PyObject *key, PyObject *failobj)
|
||||
/*[clinic end generated code: output=c4a84a7ddbca9b7b input=7c976a78f258e915]*/
|
||||
dict_get_impl(PyDictObject *self, PyObject *key, PyObject *default_value)
|
||||
/*[clinic end generated code: output=bba707729dee05bf input=e73ab0f028f4b2be]*/
|
||||
{
|
||||
PyObject *val = NULL;
|
||||
Py_hash_t hash;
|
||||
|
@ -2818,7 +2818,7 @@ dict_get_impl(PyDictObject *self, PyObject *key, PyObject *failobj)
|
|||
if (ix == DKIX_ERROR)
|
||||
return NULL;
|
||||
if (ix == DKIX_EMPTY || val == NULL) {
|
||||
val = failobj;
|
||||
val = default_value;
|
||||
}
|
||||
Py_INCREF(val);
|
||||
return val;
|
||||
|
@ -2912,19 +2912,20 @@ PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *defaultobj)
|
|||
dict.setdefault
|
||||
|
||||
key: object
|
||||
default as defaultobj: object = None
|
||||
default: object = None
|
||||
/
|
||||
|
||||
D.get(key,default), also set D[key]=default if key not in D.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
dict_setdefault_impl(PyDictObject *self, PyObject *key, PyObject *defaultobj)
|
||||
/*[clinic end generated code: output=692f85384b0b292e input=178f0c81d496d5cd]*/
|
||||
dict_setdefault_impl(PyDictObject *self, PyObject *key,
|
||||
PyObject *default_value)
|
||||
/*[clinic end generated code: output=f8c1101ebf69e220 input=b2826255bacd845a]*/
|
||||
{
|
||||
PyObject *val;
|
||||
|
||||
val = PyDict_SetDefault((PyObject *)self, key, defaultobj);
|
||||
val = PyDict_SetDefault((PyObject *)self, key, default_value);
|
||||
Py_XINCREF(val);
|
||||
return val;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue