summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-03-13 12:05:44 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-03-13 17:25:24 -0500
commit33aed0f590bf5a229bfcf24b8703e78b20d18b3e (patch)
tree95237fead1d2832ac64f0a4f7a86d45e97bd21f0
parent44ca2f5fe9b84edcc61a31c3d8abcd8c067d0731 (diff)
downloadpython-coveragepy-git-33aed0f590bf5a229bfcf24b8703e78b20d18b3e.tar.gz
tool: more information about the location of ast nodes when debugging
-rw-r--r--coverage/parser.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/coverage/parser.py b/coverage/parser.py
index 9c7a8d1e..09362da3 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -1225,7 +1225,12 @@ if AST_DUMP: # pragma: debugging
lineno = getattr(node, "lineno", None)
if lineno is not None:
- linemark = " @ {}".format(node.lineno)
+ linemark = " @ {},{}".format(node.lineno, node.col_offset)
+ if hasattr(node, "end_lineno"):
+ linemark += ":"
+ if node.end_lineno != node.lineno:
+ linemark += "{},".format(node.end_lineno)
+ linemark += "{}".format(node.end_col_offset)
else:
linemark = ""
head = "{}<{}{}".format(indent, node.__class__.__name__, linemark)