From 257cbde483436c4b0dc614773ba24f8123a7c01d Mon Sep 17 00:00:00 2001 From: Thomas Hunger Date: Fri, 21 Sep 2007 13:16:39 +0200 Subject: [PATCH] Use assert instead of if without else to ensure an object pointer is not NULL. gcc complained that a variable might be used uninitialized, which is true. If NULL is passed, all code gets executed with an uninitialized variable which is an error in almost every case. Since python itself never passes NULL, only a real error in other c code could trigger the assert. --- Cython/Compiler/Nodes.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 8f6b729f..12cc26db 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1141,9 +1141,8 @@ class DefNode(FuncDefNode): old_type = arg.hdr_type new_type = arg.type if old_type.is_pyobject: - code.putln("if (likely(%s)) {" % arg.hdr_cname) + code.putln("assert(%s);" % arg.hdr_cname) self.generate_arg_conversion_from_pyobject(arg, code) - code.putln("}") elif new_type.is_pyobject: self.generate_arg_conversion_to_pyobject(arg, code) else: -- 2.26.2