Skip to content

Commit f6b6a99

Browse files
gh-142411: Change documentation to reflect the new docstring adjustments in 3.13 (#142413)
1 parent ff52e90 commit f6b6a99

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

Doc/library/functions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ are always available. They are listed here in alphabetical order.
340340
It is needed to unambiguous :ref:`filter <warning-filter>` syntax warnings
341341
by module name.
342342

343-
This function raises :exc:`SyntaxError` if the compiled source is invalid,
344-
and :exc:`ValueError` if the source contains null bytes.
343+
This function raises :exc:`SyntaxError` or :exc:`ValueError` if the compiled
344+
source is invalid.
345345

346346
If you want to parse Python code into its AST representation, see
347347
:func:`ast.parse`.

Doc/tutorial/controlflow.rst

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,31 +1039,28 @@ blank, visually separating the summary from the rest of the description. The
10391039
following lines should be one or more paragraphs describing the object's calling
10401040
conventions, its side effects, etc.
10411041

1042-
The Python parser does not strip indentation from multi-line string literals in
1043-
Python, so tools that process documentation have to strip indentation if
1044-
desired. This is done using the following convention. The first non-blank line
1045-
*after* the first line of the string determines the amount of indentation for
1046-
the entire documentation string. (We can't use the first line since it is
1047-
generally adjacent to the string's opening quotes so its indentation is not
1048-
apparent in the string literal.) Whitespace "equivalent" to this indentation is
1049-
then stripped from the start of all lines of the string. Lines that are
1050-
indented less should not occur, but if they occur all their leading whitespace
1051-
should be stripped. Equivalence of whitespace should be tested after expansion
1052-
of tabs (to 8 spaces, normally).
1042+
The Python parser strips indentation from multi-line string literals when they
1043+
serve as module, class, or function docstrings.
10531044

10541045
Here is an example of a multi-line docstring::
10551046

10561047
>>> def my_function():
10571048
... """Do nothing, but document it.
10581049
...
1059-
... No, really, it doesn't do anything.
1050+
... No, really, it doesn't do anything:
1051+
...
1052+
... >>> my_function()
1053+
... >>>
10601054
... """
10611055
... pass
10621056
...
10631057
>>> print(my_function.__doc__)
10641058
Do nothing, but document it.
10651059

1066-
No, really, it doesn't do anything.
1060+
No, really, it doesn't do anything:
1061+
1062+
>>> my_function()
1063+
>>>
10671064

10681065

10691066
.. _tut-annotations:

0 commit comments

Comments
 (0)