diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-19 17:00:30 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-19 17:00:30 (GMT) |
commit | 48088ee9bae9bd7ceff491cb0bc82e4394c7ec23 (patch) | |
tree | 230eccad66b84e44cc70d2b52c2d0e440953fe63 /Objects | |
parent | 41baebd8b94c44646bd80c3c0519e757c00940f5 (diff) | |
download | cpython-48088ee9bae9bd7ceff491cb0bc82e4394c7ec23.zip cpython-48088ee9bae9bd7ceff491cb0bc82e4394c7ec23.tar.gz cpython-48088ee9bae9bd7ceff491cb0bc82e4394c7ec23.tar.bz2 |
Issue #29311: Argument Clinic generates reasonable name for the parameter "default".
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/clinic/dictobject.c.h | 19 | ||||
-rw-r--r-- | Objects/dictobject.c | 17 |
2 files changed, 19 insertions, 17 deletions
diff --git a/Objects/clinic/dictobject.c.h b/Objects/clinic/dictobject.c.h index 21c2b0b..deec424 100644 --- a/Objects/clinic/dictobject.c.h +++ b/Objects/clinic/dictobject.c.h @@ -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]*/ diff --git a/Objects/dictobject.c b/Objects/dictobject.c index f941486..9ff52c3 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -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; } |