mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.10] gh-92858: Improve error message for some suites with syntax error before ':' (GH-92894). (#94183)
(cherry picked from commit 2fc83ac3af)
Co-authored-by: wookie184 <wookie1840@gmail.com>
Co-authored-by: wookie184 <wookie1840@gmail.com>
This commit is contained in:
parent
34be807139
commit
05cae26572
4 changed files with 658 additions and 496 deletions
|
|
@ -403,7 +403,7 @@
|
|||
>>> class C(x for x in L):
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: expected ':'
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> def g(*args, **kwargs):
|
||||
... print(args, sorted(kwargs.items()))
|
||||
|
|
@ -759,17 +759,22 @@
|
|||
...
|
||||
SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
|
||||
|
||||
Missing ':' before suites:
|
||||
Missing ':' before suites:
|
||||
|
||||
>>> def f()
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: expected ':'
|
||||
>>> def f()
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: expected ':'
|
||||
|
||||
>>> class A
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: expected ':'
|
||||
>>> class A
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: expected ':'
|
||||
|
||||
>>> class R&D:
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> if 1
|
||||
... pass
|
||||
|
|
@ -803,6 +808,11 @@
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: expected ':'
|
||||
|
||||
>>> for x in range 10:
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> while True
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
|
|
@ -848,6 +858,11 @@
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: expected ':'
|
||||
|
||||
>>> with block ad something:
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> try
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
|
|
@ -866,6 +881,12 @@
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: expected ':'
|
||||
|
||||
>>> match x x:
|
||||
... case list():
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> match x:
|
||||
... case list()
|
||||
... pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue