Commit 99da1f3a authored by Stefan Behnel's avatar Stefan Behnel

always optimise tuple(some_list), not only for literals

parent bb09b855
......@@ -667,8 +667,9 @@ class OptimizeBuiltinCalls(Visitor.VisitorTransform):
return node
if not isinstance(list_arg, (ExprNodes.ComprehensionNode,
ExprNodes.ListNode)):
# everything else may be None => take the safe path
return node
pos_args.args[0] = ExprNodes.NoneCheckNode(
list_arg, "PyExc_TypeError",
"'NoneType' object is not iterable")
return ExprNodes.PythonCapiCallNode(
node.pos, "PyList_AsTuple", self.PyList_AsTuple_func_type,
......
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