Commit 8230d3b9 authored by Vitja Makarov's avatar Vitja Makarov

Fix genexpr inside comprehension, ticket #715

--HG--
extra : transplant_source : %3C%F8.%D8.%9C%C3%DD%C7%7C%B2%CAo%16%FAg%F2%40%04%C4
parent 1532b5de
......@@ -4529,7 +4529,7 @@ class ScopedExprNode(ExprNode):
class ComprehensionNode(ScopedExprNode):
subexprs = ["target"]
child_attrs = ["loop", "append"]
child_attrs = ["loop"]
def infer_type(self, env):
return self.target.infer_type(env)
......
......@@ -1513,6 +1513,10 @@ class GeneratorExpressionScope(Scope):
self.entries[name] = entry
return entry
def declare_pyfunction(self, name, pos, allow_redefine=False):
return self.outer_scope.declare_pyfunction(
name, pos, allow_redefine)
def declare_lambda_function(self, func_cname, pos):
return self.outer_scope.declare_lambda_function(func_cname, pos)
......
# mode: run
# ticket: 715
# tags: genexpr, comprehension
def t715(*items):
"""
# Blocked by T724
# >>> [list(i) for i in t715([1, 2, 3], [4, 5, 6])]
# [[1, 2, 3], [4, 5, 6]]
>>> [list(i) for i in t715([1, 2, 3])]
[[1, 2, 3]]
"""
return [(j for j in i) for i in items]
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