fix #682: compiler crash on auto_cpdef redefinition
authorStefan Behnel <scoder@users.berlios.de>
Wed, 13 Apr 2011 18:36:38 +0000 (20:36 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 13 Apr 2011 18:36:38 +0000 (20:36 +0200)
Cython/Compiler/ParseTreeTransforms.py

index d70dce805ba0295495405f614a4c5e4b61e7b0d4..e004852e5e430a51b30153c9d71a035aabaf381e 100644 (file)
@@ -1399,7 +1399,8 @@ class AlignFunctionDefinitions(CythonTransform):
                 return self.visit_CClassDefNode(node.as_cclass(), pxd_def)
             else:
                 error(node.pos, "'%s' redeclared" % node.name)
-                error(pxd_def.pos, "previous declaration here")
+                if pxd_def.pos:
+                    error(pxd_def.pos, "previous declaration here")
                 return None
         else:
             return node
@@ -1420,7 +1421,8 @@ class AlignFunctionDefinitions(CythonTransform):
         if pxd_def:
             if not pxd_def.is_cfunction:
                 error(node.pos, "'%s' redeclared" % node.name)
-                error(pxd_def.pos, "previous declaration here")
+                if pxd_def.pos:
+                    error(pxd_def.pos, "previous declaration here")
                 return None
             node = node.as_cfunction(pxd_def)
         elif self.scope.is_module_scope and self.directives['auto_cpdef']: