Commit 155664e8 authored by Vitja Makarov's avatar Vitja Makarov

Fix genexpr inside comprehension, ticket #715

parent f8f64ff3
...@@ -4554,7 +4554,7 @@ class ScopedExprNode(ExprNode): ...@@ -4554,7 +4554,7 @@ class ScopedExprNode(ExprNode):
class ComprehensionNode(ScopedExprNode): class ComprehensionNode(ScopedExprNode):
subexprs = ["target"] subexprs = ["target"]
child_attrs = ["loop", "append"] child_attrs = ["loop"]
def infer_type(self, env): def infer_type(self, env):
return self.target.infer_type(env) return self.target.infer_type(env)
......
...@@ -1512,6 +1512,10 @@ class GeneratorExpressionScope(Scope): ...@@ -1512,6 +1512,10 @@ class GeneratorExpressionScope(Scope):
self.entries[name] = entry self.entries[name] = entry
return 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): def declare_lambda_function(self, func_cname, pos):
return self.outer_scope.declare_lambda_function(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