diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2022-09-09 08:37:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-09 08:37:02 (GMT) |
commit | 30cc1901efa18180a83bf8402df9e1c10d877c49 (patch) | |
tree | 49d430ab9b3e13b1f7b229967f00ba6515768427 | |
parent | 569ca27293eec89b5b41c3a12e6531d3eddf0e1b (diff) | |
download | cpython-30cc1901efa18180a83bf8402df9e1c10d877c49.zip cpython-30cc1901efa18180a83bf8402df9e1c10d877c49.tar.gz cpython-30cc1901efa18180a83bf8402df9e1c10d877c49.tar.bz2 |
gh-96364: Fix text signatures of `__getitem__` for `list` and `dict` (GH-96365)
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2022-08-29-00-37-21.gh-issue-96364.c-IVyb.rst | 1 | ||||
-rw-r--r-- | Objects/dictobject.c | 3 | ||||
-rw-r--r-- | Objects/listobject.c | 3 |
3 files changed, 5 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-08-29-00-37-21.gh-issue-96364.c-IVyb.rst b/Misc/NEWS.d/next/Core and Builtins/2022-08-29-00-37-21.gh-issue-96364.c-IVyb.rst new file mode 100644 index 0000000..8872f9a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2022-08-29-00-37-21.gh-issue-96364.c-IVyb.rst @@ -0,0 +1 @@ +Fix text signatures of ``list.__getitem__`` and ``dict.__getitem__``. diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 0cb95d5..c603e6f 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -3591,7 +3591,8 @@ dict_ior(PyObject *self, PyObject *other) return self; } -PyDoc_STRVAR(getitem__doc__, "x.__getitem__(y) <==> x[y]"); +PyDoc_STRVAR(getitem__doc__, +"__getitem__($self, key, /)\n--\n\nReturn self[key]."); PyDoc_STRVAR(sizeof__doc__, "D.__sizeof__() -> size of D in memory, in bytes"); diff --git a/Objects/listobject.c b/Objects/listobject.c index 9afa68f..6005466 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2824,7 +2824,8 @@ static PyObject *list_iter(PyObject *seq); static PyObject *list_subscript(PyListObject*, PyObject*); static PyMethodDef list_methods[] = { - {"__getitem__", (PyCFunction)list_subscript, METH_O|METH_COEXIST, "x.__getitem__(y) <==> x[y]"}, + {"__getitem__", (PyCFunction)list_subscript, METH_O|METH_COEXIST, + PyDoc_STR("__getitem__($self, index, /)\n--\n\nReturn self[index].")}, LIST___REVERSED___METHODDEF LIST___SIZEOF___METHODDEF LIST_CLEAR_METHODDEF |