From 76529ca34de96edc38a4635f0be483b43957dcbc Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 26 May 2017 12:52:52 -0400 Subject: [PATCH] The parser_cache contents have changed. Therefore adapt. --- jedi/api/classes.py | 2 +- test/test_api/test_api.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jedi/api/classes.py b/jedi/api/classes.py index 54cf9a65..c48f0381 100644 --- a/jedi/api/classes.py +++ b/jedi/api/classes.py @@ -389,7 +389,7 @@ class BaseDefinition(object): return '' path = self._name.get_root_context().py__file__() - lines = parser_cache[path].lines + lines = parser_cache[self._evaluator.grammar._hashed][path].lines line_nr = self._name.start_pos[0] start_line_nr = line_nr - before diff --git a/test/test_api/test_api.py b/test/test_api/test_api.py index e047922e..915534b0 100644 --- a/test/test_api/test_api.py +++ b/test/test_api/test_api.py @@ -13,9 +13,10 @@ from parso import cache def test_preload_modules(): def check_loaded(*modules): # +1 for None module (currently used) - assert len(parser_cache) == len(modules) + 1 + grammar_cache = next(iter(parser_cache.values())) + assert len(grammar_cache) == len(modules) + 1 for i in modules: - assert [i in k for k in parser_cache.keys() if k is not None] + assert [i in k for k in grammar_cache.keys() if k is not None] temp_cache, cache.parser_cache = cache.parser_cache, {} parser_cache = cache.parser_cache