forked from VimPlug/jedi
Add the grammar as an argument to saving the parser.
This makes collisions of different grammars when loading from the cache impossible.
This commit is contained in:
@@ -456,14 +456,14 @@ def _load_module(evaluator, path=None, source=None, sys_path=None, parent_module
|
||||
if path is not None and path.endswith(('.py', '.zip', '.egg')) \
|
||||
and dotted_path not in settings.auto_import_modules:
|
||||
|
||||
cached = load_parser(path)
|
||||
cached = load_parser(evaluator.grammar, path)
|
||||
if cached is None:
|
||||
if source is None:
|
||||
with open(path, 'rb') as f:
|
||||
source = f.read()
|
||||
|
||||
p = FastParser(evaluator.grammar, source_to_unicode(source), path)
|
||||
save_parser(path, p)
|
||||
save_parser(evaluator.grammar, path, p)
|
||||
module_node = p.get_root_node()
|
||||
else:
|
||||
module_node = cached.get_root_node()
|
||||
|
||||
@@ -221,10 +221,10 @@ def _get_paths_from_buildout_script(evaluator, buildout_script):
|
||||
return
|
||||
|
||||
p = ParserWithRecovery(evaluator.grammar, source, buildout_script)
|
||||
save_parser(buildout_script, p)
|
||||
save_parser(evaluator.grammar, buildout_script, p)
|
||||
return p.get_root_node()
|
||||
|
||||
cached = load_parser(buildout_script)
|
||||
cached = load_parser(evaluator.grammar, buildout_script)
|
||||
module_node = cached and cached.module or load(buildout_script)
|
||||
if module_node is None:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user