Commit 0beafeee authored by Stefan Behnel's avatar Stefan Behnel

continue to disallow "yield from" in async functions

parent e3ec8cd8
...@@ -9415,7 +9415,7 @@ class YieldExprNode(ExprNode): ...@@ -9415,7 +9415,7 @@ class YieldExprNode(ExprNode):
expr_keyword = 'yield' expr_keyword = 'yield'
def analyse_types(self, env): def analyse_types(self, env):
if not self.label_num: if not self.label_num or (self.is_yield_from and self.in_async_gen):
error(self.pos, "'%s' not supported here" % self.expr_keyword) error(self.pos, "'%s' not supported here" % self.expr_keyword)
self.is_temp = 1 self.is_temp = 1
if self.arg is not None: if self.arg is not None:
...@@ -9552,6 +9552,7 @@ class AwaitExprNode(YieldFromExprNode): ...@@ -9552,6 +9552,7 @@ class AwaitExprNode(YieldFromExprNode):
# arg ExprNode the Awaitable value to await # arg ExprNode the Awaitable value to await
# label_num integer yield label number # label_num integer yield label number
is_yield_from = False
is_await = True is_await = True
expr_keyword = 'await' expr_keyword = 'await'
......
...@@ -6,5 +6,4 @@ async def foo(): ...@@ -6,5 +6,4 @@ async def foo():
_ERRORS = """ _ERRORS = """
5:4: 'yield from' not supported here 5:4: 'yield from' not supported here
5:4: 'yield' not allowed in async coroutines (use 'await')
""" """
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment