Commit 67d948aa authored by Stefan Behnel's avatar Stefan Behnel

avoid generating some unreachable code on function exit

parent fc2de434
......@@ -1799,6 +1799,7 @@ class FuncDefNode(StatNode, BlockNode):
code.putln("/* function exit code */")
# ----- Default return value
if not self.body.is_terminator:
if self.return_type.is_pyobject:
#if self.return_type.is_extension_type:
# lhs = "(PyObject *)%s" % Naming.retval_cname
......@@ -1811,6 +1812,7 @@ class FuncDefNode(StatNode, BlockNode):
code.putln("%s = %s;" % (Naming.retval_cname, val))
# ----- Error cleanup
if code.error_label in code.labels_used:
if not self.body.is_terminator:
code.put_goto(code.return_label)
code.put_label(code.error_label)
for cname, type in code.funcstate.all_managed_temps():
......
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