summaryrefslogtreecommitdiff
path: root/coverage/collector.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-02-19 21:14:55 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-02-19 21:14:55 -0500
commitc42d59368950e072056da5ba1c34aceac3d7f1f3 (patch)
treebd01105e01acef7278eda72e4a5cee4934b4c0e8 /coverage/collector.py
parent7ed2d4c4d61474912eb5bda718dbacd8a03dc635 (diff)
downloadpython-coveragepy-git-c42d59368950e072056da5ba1c34aceac3d7f1f3.tar.gz
Don't report negative line numbers through get_line_data
Diffstat (limited to 'coverage/collector.py')
-rw-r--r--coverage/collector.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/coverage/collector.py b/coverage/collector.py
index c1560902..948cbbb0 100644
--- a/coverage/collector.py
+++ b/coverage/collector.py
@@ -291,10 +291,14 @@ class Collector(object):
"""
if self.branch:
# If we were measuring branches, then we have to re-build the dict
- # to show line data.
+ # to show line data. We'll use the first lines of all the arcs,
+ # if they are actual lines. We don't need the second lines, because
+ # the second lines will also be first lines, sometimes to exits.
line_data = {}
for f, arcs in self.data.items():
- line_data[f] = dict((l1, None) for l1, _ in arcs.keys() if l1)
+ line_data[f] = dict(
+ (l1, None) for l1, _ in arcs.keys() if l1 > 0
+ )
return line_data
else:
return self.data