fix return value setting for 'except *' functions
authorStefan Behnel <scoder@users.berlios.de>
Fri, 6 Jun 2008 15:11:57 +0000 (17:11 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 6 Jun 2008 15:11:57 +0000 (17:11 +0200)
Cython/Compiler/Nodes.py

index 58831036d7e107e4dd7cfba5c64d017f79670e3a..0e5af11a88f509129523119ea7c2696883c189e8 100644 (file)
@@ -956,6 +956,8 @@ class FuncDefNode(StatNode, BlockNode):
             exc_check = self.caller_will_check_exceptions()
             if err_val is not None or exc_check:
                 code.putln('__Pyx_AddTraceback("%s");' % self.entry.qualified_name)
+                if err_val is None and self.return_type.default_value:
+                    err_val = self.return_type.default_value
                 if err_val is not None:
                     code.putln(
                         "%s = %s;" % (