From 7c02632fdc18f837fb4fe74728c3f0a50eea7a13 Mon Sep 17 00:00:00 2001 From: David Halter Date: Thu, 10 Jan 2013 12:10:35 +0100 Subject: [PATCH] simplify parser_cache checks --- jedi/fast_parser.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jedi/fast_parser.py b/jedi/fast_parser.py index ae50e2a5..c180b448 100644 --- a/jedi/fast_parser.py +++ b/jedi/fast_parser.py @@ -139,12 +139,13 @@ class CachedFastParser(type): def __call__(self, source, module_path=None, user_position=None): if not settings.fast_parser: return parsing.PyFuzzyParser(source, module_path, user_position) - if module_path is None or module_path not in cache.parser_cache: + + p = cache.parser_cache.get(module_path, None) + if p is None or isinstance(p, parsing.PyFuzzyParser): p = super(CachedFastParser, self).__call__(source, module_path, user_position) cache.parser_cache[module_path] = p else: - p = cache.parser_cache[module_path] p.update(source, user_position) return p