1
0
forked from VimPlug/jedi

Avoid caching parso objects, fixes #1723

This commit is contained in:
Dave Halter
2021-01-14 00:29:34 +01:00
parent 44d77523b3
commit b9067ccdbb
6 changed files with 66 additions and 23 deletions

View File

@@ -13,7 +13,6 @@ from pathlib import Path
import parso
from parso.python import tree
from jedi._compatibility import cast_path
from jedi.parser_utils import get_executable_nodes
from jedi import debug
from jedi import settings
@@ -151,7 +150,7 @@ class Script:
if self.path is None:
file_io = None
else:
file_io = KnownContentFileIO(cast_path(self.path), self._code)
file_io = KnownContentFileIO(self.path, self._code)
if self.path is not None and self.path.suffix == '.pyi':
# We are in a stub file. Try to load the stub properly.
stub_module = load_proper_stub_module(
@@ -728,9 +727,13 @@ class Interpreter(Script):
@cache.memoize_method
def _get_module_context(self):
if self.path is None:
file_io = None
else:
file_io = KnownContentFileIO(self.path, self._code)
tree_module_value = ModuleValue(
self._inference_state, self._module_node,
file_io=KnownContentFileIO(str(self.path), self._code),
file_io=file_io,
string_names=('__main__',),
code_lines=self._code_lines,
)