From: Stefan Behnel Date: Sun, 29 Mar 2009 19:46:04 +0000 (+0200) Subject: None check for optimised dict() call X-Git-Tag: 0.12.alpha0~340 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8d9427cb4e323afca41f06c455b991cc8df326dd;p=cython.git None check for optimised dict() call --- diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index ebbf497b..c90af1cc 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -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 )