Commit 257cbde4 authored by Thomas Hunger's avatar Thomas Hunger

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.
parent 174886bf
......@@ -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:
......
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