Commit f3f5cd7e authored by Stefan Behnel's avatar Stefan Behnel

fix compiler crash when using locals() and generator expressions in the same function

parent cdb895f6
...@@ -3057,8 +3057,10 @@ class GeneratorBodyDefNode(DefNode): ...@@ -3057,8 +3057,10 @@ class GeneratorBodyDefNode(DefNode):
def declare_generator_body(self, env): def declare_generator_body(self, env):
prefix = env.next_id(env.scope_prefix) prefix = env.next_id(env.scope_prefix)
name = env.next_id('generator') name = env.next_id('generator')
entry = env.declare_var(prefix + name, py_object_type, self.pos, visibility='private') cname = Naming.genbody_prefix + prefix + name
entry.func_cname = Naming.genbody_prefix + prefix + name entry = env.declare_var(None, py_object_type, self.pos,
cname=cname, visibility='private')
entry.func_cname = cname
entry.qualified_name = EncodedString(self.name) entry.qualified_name = EncodedString(self.name)
self.entry = entry self.entry = entry
......
# mode: run
# tag: genexpr, locals
def genexpr_not_in_locals():
"""
>>> genexpr_not_in_locals()
{'t': (0, 1, 4, 9, 16, 25, 36, 49, 64, 81)}
"""
t = tuple(x*x for x in range(10))
return locals()
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