Commit 735a0a87 authored by Stefan Behnel's avatar Stefan Behnel

disambiguate attribute name ("is_async_gen" it too close to an existing "is_asyncgen")

parent 9980ff6c
...@@ -4031,12 +4031,12 @@ class GeneratorBodyDefNode(DefNode): ...@@ -4031,12 +4031,12 @@ class GeneratorBodyDefNode(DefNode):
is_generator_body = True is_generator_body = True
is_inlined = False is_inlined = False
is_async_gen = False is_async_gen_body = False
inlined_comprehension_type = None # container type for inlined comprehensions inlined_comprehension_type = None # container type for inlined comprehensions
def __init__(self, pos=None, name=None, body=None, is_async_gen=False): def __init__(self, pos=None, name=None, body=None, is_async_gen_body=False):
super(GeneratorBodyDefNode, self).__init__( super(GeneratorBodyDefNode, self).__init__(
pos=pos, body=body, name=name, is_async_gen=is_async_gen, pos=pos, body=body, name=name, is_async_gen_body=is_async_gen_body,
doc=None, args=[], star_arg=None, starstar_arg=None) doc=None, args=[], star_arg=None, starstar_arg=None)
def declare_generator_body(self, env): def declare_generator_body(self, env):
...@@ -4135,7 +4135,7 @@ class GeneratorBodyDefNode(DefNode): ...@@ -4135,7 +4135,7 @@ class GeneratorBodyDefNode(DefNode):
# path: no traceback info is required and not creating it is much faster # path: no traceback info is required and not creating it is much faster
if not self.is_inlined and not self.body.is_terminator: if not self.is_inlined and not self.body.is_terminator:
code.putln('PyErr_SetNone(%s);' % ( code.putln('PyErr_SetNone(%s);' % (
'__Pyx_PyExc_StopAsyncIteration' if self.is_async_gen else 'PyExc_StopIteration')) '__Pyx_PyExc_StopAsyncIteration' if self.is_async_gen_body else 'PyExc_StopIteration'))
# ----- Error cleanup # ----- Error cleanup
if code.label_used(code.error_label): if code.label_used(code.error_label):
if not self.body.is_terminator: if not self.body.is_terminator:
...@@ -4146,7 +4146,7 @@ class GeneratorBodyDefNode(DefNode): ...@@ -4146,7 +4146,7 @@ class GeneratorBodyDefNode(DefNode):
if Future.generator_stop in env.global_scope().context.future_directives: if Future.generator_stop in env.global_scope().context.future_directives:
# PEP 479: turn accidental StopIteration exceptions into a RuntimeError # PEP 479: turn accidental StopIteration exceptions into a RuntimeError
code.globalstate.use_utility_code(UtilityCode.load_cached("pep479", "Coroutine.c")) code.globalstate.use_utility_code(UtilityCode.load_cached("pep479", "Coroutine.c"))
code.putln("__Pyx_Generator_Replace_StopIteration(%d);" % bool(self.is_async_gen)) code.putln("__Pyx_Generator_Replace_StopIteration(%d);" % bool(self.is_async_gen_body))
for cname, type in code.funcstate.all_managed_temps(): for cname, type in code.funcstate.all_managed_temps():
code.put_xdecref(cname, type) code.put_xdecref(cname, type)
code.put_add_traceback(self.entry.qualified_name) code.put_add_traceback(self.entry.qualified_name)
......
...@@ -2552,7 +2552,7 @@ class MarkClosureVisitor(CythonTransform): ...@@ -2552,7 +2552,7 @@ class MarkClosureVisitor(CythonTransform):
gbody = Nodes.GeneratorBodyDefNode( gbody = Nodes.GeneratorBodyDefNode(
pos=node.pos, name=node.name, body=node.body, pos=node.pos, name=node.name, body=node.body,
is_async_gen=node.is_async_def and collector.has_yield) is_async_gen_body=node.is_async_def and collector.has_yield)
coroutine = coroutine_type( coroutine = coroutine_type(
pos=node.pos, name=node.name, args=node.args, pos=node.pos, name=node.name, args=node.args,
star_arg=node.star_arg, starstar_arg=node.starstar_arg, star_arg=node.star_arg, starstar_arg=node.starstar_arg,
......
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