Include stdexcept in all cases.
authorRobert Bradshaw <robertwb@math.washington.edu>
Fri, 3 Apr 2009 22:59:21 +0000 (15:59 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Fri, 3 Apr 2009 22:59:21 +0000 (15:59 -0700)
Cython/Compiler/Nodes.py

index 8840933eec07741f6823c50ac09a86b4f1fe615e..706dbea7c4b2d3355bc7134efebdc88b02f2cf3e 100644 (file)
@@ -565,6 +565,8 @@ class CFuncDeclaratorNode(CDeclaratorNode):
         
         exc_val = None
         exc_check = 0
+        if self.exception_check == '+':
+            env.add_include_file('stdexcept')
         if return_type.is_pyobject \
             and (self.exception_value or self.exception_check) \
             and self.exception_check != '+':
@@ -575,7 +577,6 @@ class CFuncDeclaratorNode(CDeclaratorNode):
                 self.exception_value.analyse_const_expression(env)
                 if self.exception_check == '+':
                     exc_val_type = self.exception_value.type
-                    env.add_include_file('stdexcept')
                     if not exc_val_type.is_error and \
                           not exc_val_type.is_pyobject and \
                           not (exc_val_type.is_cfunction and not exc_val_type.return_type.is_pyobject and len(exc_val_type.args)==0):