]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-96364: Fix text signatures of `__getitem__` for `list` and `dict` (GH-96365)
authorNikita Sobolev <mail@sobolevn.me>
Fri, 9 Sep 2022 08:37:02 +0000 (11:37 +0300)
committerGitHub <noreply@github.com>
Fri, 9 Sep 2022 08:37:02 +0000 (17:37 +0900)
Misc/NEWS.d/next/Core and Builtins/2022-08-29-00-37-21.gh-issue-96364.c-IVyb.rst [new file with mode: 0644]
Objects/dictobject.c
Objects/listobject.c

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 (file)
index 0000000..8872f9a
--- /dev/null
@@ -0,0 +1 @@
+Fix text signatures of ``list.__getitem__`` and ``dict.__getitem__``.
index 0cb95d52360ef198d3b98e0a3065f25d26d15b62..c603e6f1f87449fb405dd2eba1b393b3cb5161f5 100644 (file)
@@ -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");
index 9afa68f9fe100cf7dbe74646603cc04583edb694..6005466f95fdb1d442d2c9693a8c6f72ca793587 100644 (file)
@@ -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