diff --git a/parso/cache.py b/parso/cache.py index bc9cef0..cc9e4ee 100644 --- a/parso/cache.py +++ b/parso/cache.py @@ -155,7 +155,7 @@ def _get_hashed_path(grammar, path, cache_path=None): directory = _get_cache_directory_path(cache_path=cache_path) file_hash = hashlib.sha256(path.encode("utf-8")).hexdigest() - return os.path.join(directory, '%s-%s.pkl' % (grammar.sha256, file_hash)) + return os.path.join(directory, '%s-%s.pkl' % (grammar._sha256, file_hash)) def _get_cache_directory_path(cache_path=None): diff --git a/parso/grammar.py b/parso/grammar.py index e61660c..927696c 100644 --- a/parso/grammar.py +++ b/parso/grammar.py @@ -9,7 +9,7 @@ class Grammar(object): self._parser = parser self._tokenizer = tokenizer self._diff_parser = diff_parser - self.sha256 = hashlib.sha256(bnf_text.encode("utf-8")).hexdigest() + self._sha256 = hashlib.sha256(bnf_text.encode("utf-8")).hexdigest() def __repr__(self): labels = self._pgen_grammar.symbol2number.values()