Commit 2ab39827 authored by Stefan Behnel's avatar Stefan Behnel

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

--HG--
extra : transplant_source : %D0%C1g%D5%EA%CE%FE%C36%A5%28%D25J%DF%AD%FB%A3%A3%B2
parent 1057f3e0
...@@ -3017,8 +3017,10 @@ class GeneratorBodyDefNode(DefNode): ...@@ -3017,8 +3017,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