diff --git a/jedi/evaluate/compiled/subprocess/__init__.py b/jedi/evaluate/compiled/subprocess/__init__.py index cf21b51b..25644ac8 100644 --- a/jedi/evaluate/compiled/subprocess/__init__.py +++ b/jedi/evaluate/compiled/subprocess/__init__.py @@ -156,9 +156,8 @@ class CompiledSubprocess(object): pid, ) - @property @memoize_method - def _process(self): + def _get_process(self): debug.dbg('Start environment subprocess %s', self._executable) parso_path = sys.modules['parso'].__file__ args = ( @@ -204,8 +203,8 @@ class CompiledSubprocess(object): def _kill(self): self.is_crashed = True try: - self._process.kill() - self._process.wait() + self._get_process().kill() + self._get_process().wait() except (AttributeError, TypeError): # If the Python process is terminating, it will remove some modules # earlier than others and in general it's unclear how to deal with @@ -226,7 +225,7 @@ class CompiledSubprocess(object): data = evaluator_id, function, args, kwargs try: - pickle_dump(data, self._process.stdin, self._pickle_protocol) + pickle_dump(data, self._get_process().stdin, self._pickle_protocol) except (socket.error, IOError) as e: # Once Python2 will be removed we can just use `BrokenPipeError`. # Also, somehow in windows it returns EINVAL instead of EPIPE if @@ -239,10 +238,10 @@ class CompiledSubprocess(object): % self._executable) try: - is_exception, traceback, result = pickle_load(self._process.stdout) + is_exception, traceback, result = pickle_load(self._get_process().stdout) except EOFError as eof_error: try: - stderr = self._process.stderr.read().decode('utf-8', 'replace') + stderr = self._get_process().stderr.read().decode('utf-8', 'replace') except Exception as exc: stderr = '' % exc self._kill()