mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-43149: Improve error message for exception group without parentheses (GH-24467)
This commit is contained in:
parent
0ec57e25c9
commit
206cbdab16
4 changed files with 862 additions and 603 deletions
|
@ -835,6 +835,39 @@ Make sure that the old "raise X, Y[, Z]" form is gone:
|
|||
...
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
Check that an exception group with missing parentheses
|
||||
raise a custom exception
|
||||
|
||||
>>> try:
|
||||
... pass
|
||||
... except A, B:
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: exception group must be parenthesized
|
||||
|
||||
>>> try:
|
||||
... pass
|
||||
... except A, B, C:
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: exception group must be parenthesized
|
||||
|
||||
>>> try:
|
||||
... pass
|
||||
... except A, B, C as blech:
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: exception group must be parenthesized
|
||||
|
||||
>>> try:
|
||||
... pass
|
||||
... except A, B, C as blech:
|
||||
... pass
|
||||
... finally:
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: exception group must be parenthesized
|
||||
|
||||
|
||||
>>> f(a=23, a=234)
|
||||
Traceback (most recent call last):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue