Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Docs: incorrect error message #116563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Privat33r-dev opened this issue Mar 10, 2024 · 1 comment
Closed

Docs: incorrect error message #116563

Privat33r-dev opened this issue Mar 10, 2024 · 1 comment
Labels
docs Documentation in the Doc dir

Comments

@Privat33r-dev
Copy link
Contributor

Privat33r-dev commented Mar 10, 2024

Documentation

Part 8 of the Python tutorial contains the following example:

>>> while True print('Hello world')
  File "<stdin>", line 1
    while True print('Hello world')
                   ^
SyntaxError: invalid syntax

As tested on Python 3.12 and 3.13, the actual error highlight would be:

>>> while True print('Hello world')
  File "<stdin>", line 1
    while True print('Hello world')
               ^^^^^
SyntaxError: invalid syntax

hence the following description might be inaccurate as well:

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 example, the error is detected at the function 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.

I guess that @pablogsal as an expert in a Python error messages might provide more data on current error handling :)

Linked PRs

@Privat33r-dev Privat33r-dev added the docs Documentation in the Doc dir label Mar 10, 2024
@terryjreedy
Copy link
Member

The change happened with the new parser in 3.10. I will change the example and change the text to 'one or more'. The rest is still the same for me also. Thank you for linking to spot of the foul.

terryjreedy added a commit to terryjreedy/cpython that referenced this issue Mar 10, 2024
There now may be multiple carets pointing at a token
rather than just a character.  Fix a sentence about
possible causes.
terryjreedy added a commit that referenced this issue Mar 11, 2024
There now may be multiple carets pointing at a token
rather than just a character.  Fix the sentence about
possible causes.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 11, 2024
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 3e45030)

Co-authored-by: Terry Jan Reedy <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 11, 2024
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 3e45030)

Co-authored-by: Terry Jan Reedy <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 11, 2024
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 3e45030)

Co-authored-by: Terry Jan Reedy <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 11, 2024
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 3e45030)

Co-authored-by: Terry Jan Reedy <[email protected]>
terryjreedy added a commit that referenced this issue Mar 11, 2024
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 3e45030)

Co-authored-by: Terry Jan Reedy <[email protected]>
terryjreedy added a commit that referenced this issue Mar 11, 2024
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 3e45030)

Co-authored-by: Terry Jan Reedy <[email protected]>
adorilson pushed a commit to adorilson/cpython that referenced this issue Mar 25, 2024
There now may be multiple carets pointing at a token
rather than just a character.  Fix the sentence about
possible causes.
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
There now may be multiple carets pointing at a token
rather than just a character.  Fix the sentence about
possible causes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants