summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-04-12 18:34:30 -0500
committerBenjamin Peterson <benjamin@python.org>2011-04-12 18:34:30 -0500
commite6181e8d6619719812fe41fee72b8ced76daf29c (patch)
tree4662f46effefd2e77348863875a17c06f112b451
parent1723d5e58a4e884ac406a94ccf8f00a3902411c6 (diff)
parent2baf17dbc2380dd70e5b06d35dee423ed8cc7183 (diff)
downloadcpython-e6181e8d6619719812fe41fee72b8ced76daf29c.tar.gz
merge 3.1
-rw-r--r--Lib/test/test_syntax.py4
-rw-r--r--Misc/NEWS3
-rw-r--r--Python/ast.c1
3 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 02372baf82..5926b69c93 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -67,6 +67,10 @@ SyntaxError: can't assign to literal
Traceback (most recent call last):
SyntaxError: can't assign to literal
+>>> b"" = 1
+Traceback (most recent call last):
+SyntaxError: can't assign to literal
+
>>> `1` = 1
Traceback (most recent call last):
SyntaxError: invalid syntax
diff --git a/Misc/NEWS b/Misc/NEWS
index c530cd8e39..bacd1b79e6 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -490,6 +490,9 @@ Core and Builtins
- Add sys.flags attribute for the new -q command-line option.
+- Issue #11506: Trying to assign to a bytes literal should result in a
+ SyntaxError.
+
Library
-------
diff --git a/Python/ast.c b/Python/ast.c
index 4edf335c33..2ee2186198 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -483,6 +483,7 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
case Set_kind:
case Num_kind:
case Str_kind:
+ case Bytes_kind:
expr_name = "literal";
break;
case Ellipsis_kind: