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

Skip to content

Commit 62f8bcb

Browse files
committed
merge 3.1
2 parents b17abb1 + abdeeff commit 62f8bcb

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
@@ -490,6 +490,9 @@ Core and Builtins
490490

491491
- Add sys.flags attribute for the new -q command-line option.
492492

493+
- Issue #11506: Trying to assign to a bytes literal should result in a
494+
SyntaxError.
495+
493496
Library
494497
-------
495498

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)