mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
prevent assignment to set literals
This commit is contained in:
parent
5c995c10d4
commit
947ce58a90
3 changed files with 9 additions and 0 deletions
|
@ -468,6 +468,12 @@ Traceback (most recent call last):
|
||||||
File "<doctest test.test_syntax[50]>", line 1
|
File "<doctest test.test_syntax[50]>", line 1
|
||||||
SyntaxError: can't delete ()
|
SyntaxError: can't delete ()
|
||||||
|
|
||||||
|
>>> {1, 2, 3} = 42
|
||||||
|
Traceback (most recent call last):
|
||||||
|
...
|
||||||
|
File "<doctest test.test_syntax[50]>", line 1
|
||||||
|
SyntaxError: can't assign to literal
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
|
@ -12,6 +12,8 @@ What's New in Python 2.7?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Prevent assignment to set literals.
|
||||||
|
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -440,6 +440,7 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
|
||||||
expr_name = "dict comprehension";
|
expr_name = "dict comprehension";
|
||||||
break;
|
break;
|
||||||
case Dict_kind:
|
case Dict_kind:
|
||||||
|
case Set_kind:
|
||||||
case Num_kind:
|
case Num_kind:
|
||||||
case Str_kind:
|
case Str_kind:
|
||||||
expr_name = "literal";
|
expr_name = "literal";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue