mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-44305: Improve syntax error for try blocks without except or finally (GH-26523)
This commit is contained in:
parent
3446516ffa
commit
b250f89bb7
5 changed files with 554 additions and 440 deletions
|
@ -882,6 +882,14 @@ leading to spurious errors.
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?
|
||||
|
||||
Custom error messages for try blocks that are not followed by except/finally
|
||||
|
||||
>>> try:
|
||||
... x = 34
|
||||
...
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: expected 'except' or 'finally' block
|
||||
|
||||
Ensure that early = are not matched by the parser as invalid comparisons
|
||||
>>> f(2, 4, x=34); 1 $ 2
|
||||
Traceback (most recent call last):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue