Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 59c90c6

Browse files
committed
merge 3.2
2 parents 5809403 + 62f8bcb commit 59c90c6

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

Lib/test/test_syntax.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
Traceback (most recent call last):
6868
SyntaxError: can't assign to literal
6969
70+
>>> b"" = 1
71+
Traceback (most recent call last):
72+
SyntaxError: can't assign to literal
73+
7074
>>> `1` = 1
7175
Traceback (most recent call last):
7276
SyntaxError: invalid syntax

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,9 @@ Core and Builtins
716716

717717
- Add sys.flags attribute for the new -q command-line option.
718718

719+
- Issue #11506: Trying to assign to a bytes literal should result in a
720+
SyntaxError.
721+
719722
Library
720723
-------
721724

Python/ast.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
483483
case Set_kind:
484484
case Num_kind:
485485
case Str_kind:
486+
case Bytes_kind:
486487
expr_name = "literal";
487488
break;
488489
case Ellipsis_kind:

0 commit comments

Comments
 (0)