Kaydet (Commit) 947ce58a authored tarafından Benjamin Peterson's avatar Benjamin Peterson

prevent assignment to set literals

üst 5c995c10
......@@ -468,6 +468,12 @@ Traceback (most recent call last):
File "<doctest test.test_syntax[50]>", line 1
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
......
......@@ -12,6 +12,8 @@ What's New in Python 2.7?
Core and Builtins
-----------------
- Prevent assignment to set literals.
Library
-------
......
......@@ -440,6 +440,7 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
expr_name = "dict comprehension";
break;
case Dict_kind:
case Set_kind:
case Num_kind:
case Str_kind:
expr_name = "literal";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment