Commit 8d9427cb authored by Stefan Behnel's avatar Stefan Behnel

None check for optimised dict() call

parent 64908ab7
......@@ -527,12 +527,15 @@ class OptimizeBuiltinCalls(Visitor.VisitorTransform):
"""
if len(pos_args.args) != 1:
return node
if pos_args.args[0].type is not Builtin.dict_type:
dict_arg = pos_args.args[0]
if dict_arg.type is not Builtin.dict_type:
return node
dict_arg = ExprNodes.NoneCheckNode(
dict_arg, "PyExc_TypeError", "'NoneType' is not iterable")
return ExprNodes.PythonCapiCallNode(
node.pos, "PyDict_Copy", self.PyDict_Copy_func_type,
args = pos_args.args,
args = [dict_arg],
is_temp = node.is_temp
)
......
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