-
-
Notifications
You must be signed in to change notification settings - Fork 33k
Fix the output of syntax error example #30097
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
base: main
Are you sure you want to change the base?
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| SyntaxError: invalid syntax. Perhaps you forgot a comma? | ||
|
|
||
| The parser repeats the offending line and displays a little 'arrow' pointing at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This no longer matches the example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @iritkatriel - just checking if you need anything from my side ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence just after the example looks like it needs to be updated as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the sentence as requested - let me know if it looks good to you ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence below is now incorrect, it talks about a missing colon before print.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ This is still the case, requesting changes to make sure this is not missed.
|
@pablogsal with the irrelevant suggestion about comma, this doesn’t look like the best example to keep in the tutorial. What do you think? |
|
I agree, I would prefer also not to keep the specific errors in the docs just in case we change them in the future. Having the arrows is good, thought. |
|
Friendly ping, @pablogsal and @iritkatriel? |
|
@vivekvashist can you think of a better example, one that doesn’t generate an irrelevant suggestion? |
Would this work ? >>> greeting = 'Hello World'
>>> print greeting
File "<stdin>", line 1
print greeting
^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(greeting)? |
|
I think that’s better, yes. |
Doc/tutorial/errors.rst
Outdated
| ^^^^^^^^^^^^^^ | ||
| SyntaxError: Missing parentheses in call to 'print'. Did you mean print(greeting)? | ||
|
|
||
| The parser repeats the offending line and displays 'arrows' pointing at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually now I see that this example doesn’t demonstrate what the text mentions - that the arrows point to where the error begins. Can we find an example where the arrows don’t cover the whole line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually now I see that this example doesn’t demonstrate what the text mentions - that the arrows point to where the error begins. Can we find an example where the arrows don’t cover the whole line?
How about:
>>> a[1]] = 0
File "<stdin>", line 1
a[1]] = 0
^
SyntaxError: unmatched ']'The quote used in the example is from Monty Python :)
|
Closing and reopening to trigger the bots. |
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| SyntaxError: invalid syntax. Perhaps you forgot a comma? | ||
|
|
||
| The parser repeats the offending line and displays a little 'arrow' pointing at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ This is still the case, requesting changes to make sure this is not missed.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
@vivekvashist Would you still be interested in giving the PR a quick update per the comment above? |
|
Apologies for the delay - just to refresh my memory what changes/updates are required ? |
|
See this comment: #30097 (comment) |
| print('Are you suggesting that coconuts migrate?) | ||
| ^ | ||
| SyntaxError: unterminated string literal (detected at line 1) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spurious whitespace
| 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 | ||
| example, the error is detected at the function :func:`print`, since a single quote | ||
| (``'``) is missing. Error message and line number is also printed so you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change it to "Error message," the old sentence is perfectly fine?
| print('Are you suggesting that coconuts migrate?) | ||
| ^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The caret is not aligned with the first quote?
|
|
||
| >>> while True print('Hello world') | ||
| >>> print('Are you suggesting that coconuts migrate?) | ||
| File "<stdin>", line 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| File "<stdin>", line 1 | |
| File "<python-input-0>", line 1 |
Is that not standard for the new repl?
No description provided.