]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-150285: Fix too long docstrings in GenericAlias and __class_getitem__ (GH-151354)
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 11 Jun 2026 16:52:58 +0000 (19:52 +0300)
committerGitHub <noreply@github.com>
Thu, 11 Jun 2026 16:52:58 +0000 (19:52 +0300)
Objects/genericaliasobject.c
Objects/tupleobject.c
Objects/typevarobject.c

index 9c797e8dd6fd2cc83ccec5996d0bf86fa8f6a6d0..c2083e6fcb77f47012fa737f235427ae871b26f6 100644 (file)
@@ -572,7 +572,8 @@ PyDoc_STRVAR(genericalias__doc__,
 "--\n\n"
 "Represent a PEP 585 generic type\n"
 "\n"
-"E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).");
+"For example, for t = list[int], t.__origin__ is list and t.__args__\n"
+"is (int,).");
 
 static PyObject *
 ga_getitem(PyObject *self, PyObject *item)
index 7ad83e37bd732dd53d4cf56d2b128405546b60ab..bb5e18cb790acf0b5ab65a89801199896147f32f 100644 (file)
@@ -957,8 +957,10 @@ tuple___getnewargs___impl(PyTupleObject *self)
 
 PyDoc_STRVAR(tuple_class_getitem_doc,
 "Tuples are generic over the types of their contents.\n\n\
-For example, use ``tuple[int, str]`` for a pair whose first element is an int and second element is a string.\n\n\
-Tuples also support the form ``tuple[T, ...]`` to indicate an arbitrary length tuple of elements of type T.");
+For example, use ``tuple[int, str]`` for a pair whose first element\n\
+is an int and second element is a string.\n\n\
+Tuples also support the form ``tuple[T, ...]`` to indicate\n\
+an arbitrary length tuple of elements of type T.");
 
 static PyMethodDef tuple_methods[] = {
     TUPLE___GETNEWARGS___METHODDEF
index 8ad590cc6e60936ae8cabdab89042074892aeb77..78750a955d2a4924d064833291b9cdb955afa976 100644 (file)
@@ -2311,8 +2311,9 @@ PyDoc_STRVAR(generic_class_getitem_doc,
 "Parameterizes a generic class.\n\
 \n\
 At least, parameterizing a generic class is the *main* thing this\n\
-method does. For example, for some generic class `Foo`, this is called\n\
-when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.\n\
+method does.  For example, for some generic class `Foo`, this is\n\
+called when we do `Foo[int]` - there, with `cls=Foo` and\n\
+`params=int`.\n\
 \n\
 However, note that this method is also called when defining generic\n\
 classes in the first place with `class Foo[T]: ...`.\n\