Skip to content

Commit 30cc190

Browse files
authored
gh-96364: Fix text signatures of __getitem__ for list and dict (GH-96365)
1 parent 569ca27 commit 30cc190

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix text signatures of ``list.__getitem__`` and ``dict.__getitem__``.

Objects/dictobject.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -3591,7 +3591,8 @@ dict_ior(PyObject *self, PyObject *other)
35913591
return self;
35923592
}
35933593

3594-
PyDoc_STRVAR(getitem__doc__, "x.__getitem__(y) <==> x[y]");
3594+
PyDoc_STRVAR(getitem__doc__,
3595+
"__getitem__($self, key, /)\n--\n\nReturn self[key].");
35953596

35963597
PyDoc_STRVAR(sizeof__doc__,
35973598
"D.__sizeof__() -> size of D in memory, in bytes");

Objects/listobject.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2824,7 +2824,8 @@ static PyObject *list_iter(PyObject *seq);
28242824
static PyObject *list_subscript(PyListObject*, PyObject*);
28252825

28262826
static PyMethodDef list_methods[] = {
2827-
{"__getitem__", (PyCFunction)list_subscript, METH_O|METH_COEXIST, "x.__getitem__(y) <==> x[y]"},
2827+
{"__getitem__", (PyCFunction)list_subscript, METH_O|METH_COEXIST,
2828+
PyDoc_STR("__getitem__($self, index, /)\n--\n\nReturn self[index].")},
28282829
LIST___REVERSED___METHODDEF
28292830
LIST___SIZEOF___METHODDEF
28302831
LIST_CLEAR_METHODDEF

0 commit comments

Comments
 (0)