diff -r 48970d754841 Lib/test/test_parser.py --- a/Lib/test/test_parser.py Thu Mar 17 17:06:27 2011 +0800 +++ b/Lib/test/test_parser.py Thu Mar 17 18:50:27 2011 +0100 @@ -527,6 +527,14 @@ code2 = parser.compilest(st) self.assertEqual(eval(code2), -3) + def test_compile_assignment_to_bytes_literal(self): + st = parser.suite('b"" = 1') + self.assertRaises(SyntaxError, parser.compilest, st) + + def test_compile_augmented_assignment_to_bytes_literal(self): + st = parser.suite('b"" += 1') + self.assertRaises(SyntaxError, parser.compilest, st) + class ParserStackLimitTestCase(unittest.TestCase): """try to push the parser to/over its limits. see http://bugs.python.org/issue1881 for a discussion diff -r 48970d754841 Python/ast.c --- a/Python/ast.c Thu Mar 17 17:06:27 2011 +0800 +++ b/Python/ast.c Thu Mar 17 18:50:27 2011 +0100 @@ -483,6 +483,7 @@ case Set_kind: case Num_kind: case Str_kind: + case Bytes_kind: expr_name = "literal"; break; case Ellipsis_kind: