diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-01-16 11:23:57 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-01-16 11:23:57 -0500 |
commit | 24682d3cecd834229fde6e4e09d4380359e3a49a (patch) | |
tree | 13361021a96ef12a471af5f12dbade8354497b2b /coverage/parser.py | |
parent | 866d3f9fe853de9da6ee456a4ed5aa1cfa453e1f (diff) | |
download | python-coveragepy-git-24682d3cecd834229fde6e4e09d4380359e3a49a.tar.gz |
Stop treating yield-from and await as function returns
Diffstat (limited to 'coverage/parser.py')
-rw-r--r-- | coverage/parser.py | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/coverage/parser.py b/coverage/parser.py index f0bfe614..07cb75d2 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -404,15 +404,6 @@ class AstArcAnalyzer(object): Return a set of line numbers, exits from this node to the next. """ - # Yield-froms and awaits can appear anywhere. - # TODO: this is probably over-doing it, and too expensive. Can we - # instrument the ast walking to see how many nodes we are revisiting? - if isinstance(node, ast.stmt): - for _, value in ast.iter_fields(node): - if isinstance(value, ast.expr) and self.contains_return_expression(value): - self.process_return_exits([self.line_for_node(node)]) - break - node_name = node.__class__.__name__ handler = getattr(self, "_handle__" + node_name, None) if handler is not None: @@ -759,14 +750,6 @@ class AstArcAnalyzer(object): self.arcs.add((-1, start)) self.arcs.add((start, -start)) - def contains_return_expression(self, node): - """Is there a yield-from or await in `node` someplace?""" - for child in ast.walk(node): - if child.__class__.__name__ in ["YieldFrom", "Await"]: - return True - - return False - class ByteParser(object): """Parse bytecode to understand the structure of code.""" |