diff --git a/jedi/__main__.py b/jedi/__main__.py index 3f2d61c9..f2ee0477 100644 --- a/jedi/__main__.py +++ b/jedi/__main__.py @@ -32,6 +32,8 @@ def _start_linter(): print(error) except Exception: if '--pdb' in sys.argv: + import traceback + traceback.print_exc() import pdb pdb.post_mortem() else: diff --git a/jedi/parser/tree.py b/jedi/parser/tree.py index e59e4279..fa87203c 100644 --- a/jedi/parser/tree.py +++ b/jedi/parser/tree.py @@ -1462,4 +1462,14 @@ class CompFor(BaseNode): return _defined_names(self.children[1]) def nodes_to_execute(self, last_added=False): - return self.children[-1].nodes_to_execute() + last = self.children[-1] + if last.type == 'comp_if': + for node in last.children[-1].nodes_to_execute(): + yield node + last = self.children[-2] + elif last.type == 'comp_for': + for node in last.nodes_to_execute(): + yield node + last = self.children[-2] + for node in last.nodes_to_execute(): + yield node