summaryrefslogtreecommitdiff
path: root/coverage/collector.py
diff options
context:
space:
mode:
authorNed Batchelder <nedbat@gmail.com>2015-04-24 21:06:26 -0400
committerNed Batchelder <nedbat@gmail.com>2015-04-24 21:06:26 -0400
commit4cac18d36cd53c85f43ab79816b71cd2d4a3e6db (patch)
tree5741c738325d92c1a417b2c943f9b3f98f3417ba /coverage/collector.py
parent3d88444cd3659fb93f17cbf4288c23bc82f33ead (diff)
parentc3a98ff12933710d751ec28b984edb7936d457d3 (diff)
downloadpython-coveragepy-4cac18d36cd53c85f43ab79816b71cd2d4a3e6db.tar.gz
Merged in lep/coverage.py (pull request #48)
Fix #363: crash when annotating non-ascii characters in python 2.
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 c156090..948cbbb 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