non-compounds may be done

This commit is contained in:
Anthony Scopatz 2015-01-26 21:49:04 -06:00
parent 527ee6dd5b
commit 9604b87437
3 changed files with 15 additions and 3 deletions

View file

@ -615,6 +615,18 @@ def test_yield_x_y():
def test_yield_from_x():
yield check_stmts, 'yield from x', False
def test_return():
yield check_stmts, 'return', False
def test_return_x():
yield check_stmts, 'return x', False
def test_return_x_comma():
yield check_stmts, 'return x,', False
def test_return_x_y():
yield check_stmts, 'return x, y', False

View file

@ -7,4 +7,4 @@ from ast import Module, Num, Expr, Str, Bytes, UnaryOp, UAdd, USub, Invert, \
Name, GeneratorExp, Store, comprehension, ListComp, SetComp, DictComp, \
Assign, AugAssign, BitXor, BitAnd, BitOr, LShift, RShift, Assert, Delete, \
Del, Pass, Raise, Import, alias, ImportFrom, Continue, Break, Yield, \
YieldFrom
YieldFrom, Return

View file

@ -551,7 +551,7 @@ class Parser(object):
def p_return_stmt(self, p):
"""return_stmt : RETURN testlist_opt"""
p[0] = p[1:]
p[0] = ast.Return(value=p[2], lineno=self.lineno, col_offset=self.col)
def p_yield_stmt(self, p):
"""yield_stmt : yield_expr"""
@ -1331,7 +1331,7 @@ class Parser(object):
"""encoding_decl : NAME"""
# not used in grammar, but may appear in "node" passed from
# Parser to Compiler
p[0] = p[1:]
p[0] = p[1]
def p_yield_expr(self, p):
"""yield_expr : YIELD yield_arg_opt"""