Fix the output of syntax error example#30097
Fix the output of syntax error example#30097vivekvashist wants to merge 7 commits intopython:mainfrom
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| 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.
This no longer matches the example.
There was a problem hiding this comment.
Hi @iritkatriel - just checking if you need anything from my side ??
There was a problem hiding this comment.
The sentence just after the example looks like it needs to be updated as well.
There was a problem hiding this comment.
I've updated the sentence as requested - let me know if it looks good to you ?
There was a problem hiding this comment.
The sentence below is now incorrect, it talks about a missing colon before print.
There was a problem hiding this comment.
^ 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.
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.
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.
^ 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.
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.
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.
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.
| File "<stdin>", line 1 | |
| File "<python-input-0>", line 1 |
Is that not standard for the new repl?
|
This PR is stale because it has been open for 30 days with no activity. |
|
Closing as stale, opened #148327 so that someone else can pick this up. |
No description provided.