diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-02-09 16:26:39 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-02-09 16:26:39 -0500 |
commit | cbfefaeed86e276677d4c0aa56c5897eb67dcf10 (patch) | |
tree | a0eef2b2ccb62433606209e32d2185b858deb315 /coverage/parser.py | |
parent | 18f721da6bbc651ddd698b6986f7eb439245d62e (diff) | |
download | python-coveragepy-cbfefaeed86e276677d4c0aa56c5897eb67dcf10.tar.gz |
Properly handle empty decorated functions in 3.7. #640
Diffstat (limited to 'coverage/parser.py')
-rw-r--r-- | coverage/parser.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/coverage/parser.py b/coverage/parser.py index 590eace..6e6cccd 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -831,12 +831,13 @@ class AstArcAnalyzer(object): # in `self.statements`. For some constructs, `line_for_node` is # not what we'd think of as the first line in the statement, so map # it to the first one. - body_start = self.line_for_node(node.body[0]) - body_start = self.multiline.get(body_start, body_start) - for lineno in range(last+1, body_start): - if lineno in self.statements: - self.add_arc(last, lineno) - last = lineno + if node.body: + body_start = self.line_for_node(node.body[0]) + body_start = self.multiline.get(body_start, body_start) + for lineno in range(last+1, body_start): + if lineno in self.statements: + self.add_arc(last, lineno) + last = lineno # The body is handled in collect_arcs. return set([ArcStart(last)]) |