From 302d06de8537b2162e7b374b1134458e06708e9a Mon Sep 17 00:00:00 2001 From: David Halter Date: Fri, 3 May 2013 01:14:41 +0430 Subject: [PATCH] fix end_pos stuff in parser (no (None, None) end_pos anymore --- jedi/fast_parser.py | 1 + jedi/parsing.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/jedi/fast_parser.py b/jedi/fast_parser.py index f8465410..bab9c3fe 100644 --- a/jedi/fast_parser.py +++ b/jedi/fast_parser.py @@ -357,6 +357,7 @@ class FastParser(use_metaclass(CachedFastParser)): if self.current_node.parent and (isinstance(p.user_scope, pr.SubModule) or p.user_scope is None) \ + and self.user_position \ and p.start_pos <= self.user_position < p.end_pos: p.user_scope = self.current_node.parent.content_scope diff --git a/jedi/parsing.py b/jedi/parsing.py index 26390604..e69dad6b 100644 --- a/jedi/parsing.py +++ b/jedi/parsing.py @@ -430,8 +430,11 @@ class Parser(object): except (StopIteration, common.MultiLevelStopIteration): # on finish, set end_pos correctly s = self.scope - while s is not None and not (isinstance(s, pr.Module) - and not isinstance(s, pr.SubModule)): + while s is not None: + if isinstance(s, pr.Module) \ + and not isinstance(s, pr.SubModule): + self.module.end_pos = self.end_pos + break s.end_pos = self.end_pos s = s.parent raise