]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-116563: Update tutorial error example (GH-116569) (#116624)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 11 Mar 2024 22:11:44 +0000 (23:11 +0100)
committerGitHub <noreply@github.com>
Mon, 11 Mar 2024 22:11:44 +0000 (22:11 +0000)
There now may be multiple carets pointing at a token
rather than just a character.  Fix the sentence about
possible causes.
(cherry picked from commit 3e45030076bf2cfab41c4456c73fb212b7322c60)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Doc/tutorial/errors.rst

index 4058ebe8efdb42458307aca8e27e9277923c77df..0b9acd00fdc6bd02c5ec0bb6ea687543d78d14b6 100644 (file)
@@ -20,12 +20,12 @@ complaint you get while you are still learning Python::
    >>> while True print('Hello world')
      File "<stdin>", line 1
        while True print('Hello world')
-                      ^
+                  ^^^^^
    SyntaxError: invalid syntax
 
-The parser repeats the offending line and displays a little 'arrow' pointing at
-the earliest point in the line where the error was detected.  The error is
-caused by (or at least detected at) the token *preceding* the arrow: in the
+The parser repeats the offending line and displays little 'arrow's pointing
+at the token in the line where the error was detected.  The error may be
+caused by the absence of a token *before* the indicated token.  In the
 example, the error is detected at the function :func:`print`, since a colon
 (``':'``) is missing before it.  File name and line number are printed so you
 know where to look in case the input came from a script.