diff --git a/jedi/cache.py b/jedi/cache.py index a05988e4..56769d0d 100644 --- a/jedi/cache.py +++ b/jedi/cache.py @@ -212,7 +212,7 @@ def load_parser(path): def save_parser(path, parser, pickling=True): try: - p_time = os.path.getmtime(path) + p_time = None if path is None else os.path.getmtime(path) except OSError: p_time = None pickling = False diff --git a/test/test_parser/test_fast_parser.py b/test/test_parser/test_fast_parser.py index 73bc80a9..2b500872 100644 --- a/test/test_parser/test_fast_parser.py +++ b/test/test_parser/test_fast_parser.py @@ -81,7 +81,7 @@ def check_fp(src, number_parsers_used, number_of_splits=None, number_of_misses=0 number_of_splits = number_parsers_used p = FastParser(load_grammar(), u(src)) - cache.save_parser(None, None, p, pickling=False) + cache.save_parser(None, p, pickling=False) # TODO Don't change get_code, the whole thing should be the same. # -> Need to refactor the parser first, though. @@ -352,7 +352,7 @@ def test_open_parentheses(): assert p.module.get_code() == '\n\n' + func assert p.number_of_splits == 2 assert p.number_parsers_used == 2 - cache.save_parser(None, None, p, pickling=False) + cache.save_parser(None, p, pickling=False) # Now with a correct parser it should work perfectly well. check_fp('isinstance()\n' + func, 1, 2)