Fix the cache path

Any caller of Parso can specify a cache path, and if none is specified,
parso will fall back to a default.

Parso's code to read a file from the cache handled this correctly; but
its code to write a file to the cache had a bug -- any override of the
default was ignored.

In the case of Jedi, this is a significant problem, since Jedi overrides
the default. The result is that files will be written to the cache, but
will then never be found when reading from the cache.
This commit is contained in:
Mike Morearty
2017-10-22 16:58:00 -07:00
committed by Dave Halter
parent dcae8cda92
commit 89932c368d

View File

@@ -127,7 +127,7 @@ def save_module(hashed_grammar, path, module, lines, pickling=True, cache_path=N
item = _NodeCacheItem(module, lines, p_time)
parser_cache.setdefault(hashed_grammar, {})[path] = item
if pickling and path is not None:
_save_to_file_system(hashed_grammar, path, item)
_save_to_file_system(hashed_grammar, path, item, cache_path=cache_path)
def _save_to_file_system(hashed_grammar, path, item, cache_path=None):