From 735a0a87b4c131a222579a7bd663f9876975139f Mon Sep 17 00:00:00 2001 From: Stefan Behnel <stefan_ml@behnel.de> Date: Tue, 8 Aug 2017 12:34:26 +0200 Subject: [PATCH] disambiguate attribute name ("is_async_gen" it too close to an existing "is_asyncgen") --- Cython/Compiler/Nodes.py | 10 +++++----- Cython/Compiler/ParseTreeTransforms.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 160304a02..afc69a3e1 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -4031,12 +4031,12 @@ class GeneratorBodyDefNode(DefNode): is_generator_body = True is_inlined = False - is_async_gen = False + is_async_gen_body = False 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__( - 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) def declare_generator_body(self, env): @@ -4135,7 +4135,7 @@ class GeneratorBodyDefNode(DefNode): # path: no traceback info is required and not creating it is much faster if not self.is_inlined and not self.body.is_terminator: 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 if code.label_used(code.error_label): if not self.body.is_terminator: @@ -4146,7 +4146,7 @@ class GeneratorBodyDefNode(DefNode): if Future.generator_stop in env.global_scope().context.future_directives: # PEP 479: turn accidental StopIteration exceptions into a RuntimeError 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(): code.put_xdecref(cname, type) code.put_add_traceback(self.entry.qualified_name) diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 5e51cab38..4f9578b67 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -2552,7 +2552,7 @@ class MarkClosureVisitor(CythonTransform): gbody = Nodes.GeneratorBodyDefNode( 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( pos=node.pos, name=node.name, args=node.args, star_arg=node.star_arg, starstar_arg=node.starstar_arg, -- 2.30.9