diff -r 177e0254fdee Grammar/Grammar --- a/Grammar/Grammar Tue Nov 19 11:06:44 2013 -0500 +++ b/Grammar/Grammar Tue Nov 19 15:15:33 2013 -0500 @@ -19,7 +19,7 @@ file_input: (NEWLINE | stmt)* ENDMARKER eval_input: testlist NEWLINE* ENDMARKER -decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE +decorator: '@' testlist NEWLINE decorators: decorator+ decorated: decorators (classdef | funcdef) funcdef: 'def' NAME parameters ['->' test] ':' suite diff -r 177e0254fdee Lib/test/test_decorators.py --- a/Lib/test/test_decorators.py Tue Nov 19 11:06:44 2013 -0500 +++ b/Lib/test/test_decorators.py Tue Nov 19 15:15:33 2013 -0500 @@ -152,15 +152,6 @@ self.assertEqual(counts['double'], 4) def test_errors(self): - # Test syntax restrictions - these are all compile-time errors: - # - for expr in [ "1+2", "x[3]", "(1, 2)" ]: - # Sanity check: is expr is a valid expression by itself? - compile(expr, "testexpr", "exec") - - codestr = "@%s\ndef f(): pass" % expr - self.assertRaises(SyntaxError, compile, codestr, "test", "exec") - # You can't put multiple decorators on a single line: # self.assertRaises(SyntaxError, compile, diff -r 177e0254fdee Modules/parsermodule.c --- a/Modules/parsermodule.c Tue Nov 19 11:06:44 2013 -0500 +++ b/Modules/parsermodule.c Tue Nov 19 15:15:33 2013 -0500 @@ -2541,7 +2541,7 @@ ok = (validate_ntype(tree, decorator) && (nch == 3 || nch == 5 || nch == 6) && validate_at(CHILD(tree, 0)) && - validate_dotted_name(CHILD(tree, 1)) && + validate_testlist(CHILD(tree, 1)) && validate_newline(RCHILD(tree, -1))); if (ok && nch != 3) { diff -r 177e0254fdee Python/ast.c --- a/Python/ast.c Tue Nov 19 11:06:44 2013 -0500 +++ b/Python/ast.c Tue Nov 19 15:15:33 2013 -0500 @@ -1429,7 +1429,7 @@ REQ(CHILD(n, 0), AT); REQ(RCHILD(n, -1), NEWLINE); - name_expr = ast_for_dotted_name(c, CHILD(n, 1)); + name_expr = ast_for_testlist(c, CHILD(n, 1)); if (!name_expr) return NULL;