From c93d8837c3b66dcac177492388a8461883e312c4 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 15 Mar 2009 15:42:40 +0100 Subject: [PATCH] print node position in PrintTree --- Cython/Compiler/Visitor.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/Visitor.py b/Cython/Compiler/Visitor.py index 034a2e67..c7739f8d 100644 --- a/Cython/Compiler/Visitor.py +++ b/Cython/Compiler/Visitor.py @@ -342,7 +342,15 @@ class PrintTree(TreeVisitor): elif isinstance(node, ExprNodes.ExprNode): t = node.type result += "(type=%s)" % repr(t) - + elif node.pos: + pos = node.pos + path = pos[0].get_description() + if '/' in path: + path = path.split('/')[-1] + if '\\' in path: + path = path.split('\\')[-1] + result += "(pos=(%s:%s:%s))" % (path, pos[1], pos[2]) + return result if __name__ == "__main__": -- 2.26.2