mirror of
https://github.com/python/cpython.git
synced 2025-10-26 03:04:41 +00:00
gh-94192: Fix error for dictionary literals with invalid expression as value. (GH-94304)
* Fix error for dictionary literals with invalid expression as value.
* Remove trailing whitespace
(cherry picked from commit 8c237a7a71)
Co-authored-by: wookie184 <wookie1840@gmail.com>
This commit is contained in:
parent
1b27ec5ac6
commit
442dd8ffa5
4 changed files with 525 additions and 449 deletions
|
|
@ -1265,12 +1265,22 @@
|
|||
Traceback (most recent call last):
|
||||
SyntaxError: expression expected after dictionary key and ':'
|
||||
|
||||
# Ensure that the error is not raise for syntax errors that happen after sets
|
||||
# Ensure that the error is not raised for syntax errors that happen after sets
|
||||
|
||||
>>> {1} $
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
# Ensure that the error is not raised for invalid expressions
|
||||
|
||||
>>> {1: 2, 3: foo(,), 4: 5}
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
>>> {1: $, 2: 3}
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: invalid syntax
|
||||
|
||||
Specialized indentation errors:
|
||||
|
||||
>>> while condition:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue