]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-142411: Change documentation to reflect the new docstring adjustments in 3.13...
authordecorator-factory <42166884+decorator-factory@users.noreply.github.com>
Sat, 13 Dec 2025 22:29:59 +0000 (01:29 +0300)
committerGitHub <noreply@github.com>
Sat, 13 Dec 2025 22:29:59 +0000 (00:29 +0200)
Doc/library/functions.rst
Doc/tutorial/controlflow.rst

index 9cfbb5a482e9747a3173e6c327ea24705a56943e..7635e65296537d632db59f6cad10b5fab5c761f8 100644 (file)
@@ -340,8 +340,8 @@ are always available.  They are listed here in alphabetical order.
    It is needed to unambiguous :ref:`filter <warning-filter>` syntax warnings
    by module name.
 
-   This function raises :exc:`SyntaxError` if the compiled source is invalid,
-   and :exc:`ValueError` if the source contains null bytes.
+   This function raises :exc:`SyntaxError` or :exc:`ValueError` if the compiled
+   source is invalid.
 
    If you want to parse Python code into its AST representation, see
    :func:`ast.parse`.
index 5ec8789f98c7016bcaf6085f0da43c51bd207a82..f3e69756401b8bc85d40a35d77c7c533c5d52eca 100644 (file)
@@ -1039,31 +1039,28 @@ blank, visually separating the summary from the rest of the description.  The
 following lines should be one or more paragraphs describing the object's calling
 conventions, its side effects, etc.
 
-The Python parser does not strip indentation from multi-line string literals in
-Python, so tools that process documentation have to strip indentation if
-desired.  This is done using the following convention. The first non-blank line
-*after* the first line of the string determines the amount of indentation for
-the entire documentation string.  (We can't use the first line since it is
-generally adjacent to the string's opening quotes so its indentation is not
-apparent in the string literal.)  Whitespace "equivalent" to this indentation is
-then stripped from the start of all lines of the string.  Lines that are
-indented less should not occur, but if they occur all their leading whitespace
-should be stripped.  Equivalence of whitespace should be tested after expansion
-of tabs (to 8 spaces, normally).
+The Python parser strips indentation from multi-line string literals when they
+serve as module, class, or function docstrings.
 
 Here is an example of a multi-line docstring::
 
    >>> def my_function():
    ...     """Do nothing, but document it.
    ...
-   ...     No, really, it doesn't do anything.
+   ...     No, really, it doesn't do anything:
+   ...
+   ...         >>> my_function()
+   ...         >>>
    ...     """
    ...     pass
    ...
    >>> print(my_function.__doc__)
    Do nothing, but document it.
 
-   No, really, it doesn't do anything.
+   No, really, it doesn't do anything:
+
+       >>> my_function()
+       >>>
 
 
 .. _tut-annotations: