mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Avoid property, because there's a __getattr__ on that class
This commit is contained in:
@@ -156,9 +156,8 @@ class CompiledSubprocess(object):
|
|||||||
pid,
|
pid,
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
|
||||||
@memoize_method
|
@memoize_method
|
||||||
def _process(self):
|
def _get_process(self):
|
||||||
debug.dbg('Start environment subprocess %s', self._executable)
|
debug.dbg('Start environment subprocess %s', self._executable)
|
||||||
parso_path = sys.modules['parso'].__file__
|
parso_path = sys.modules['parso'].__file__
|
||||||
args = (
|
args = (
|
||||||
@@ -204,8 +203,8 @@ class CompiledSubprocess(object):
|
|||||||
def _kill(self):
|
def _kill(self):
|
||||||
self.is_crashed = True
|
self.is_crashed = True
|
||||||
try:
|
try:
|
||||||
self._process.kill()
|
self._get_process().kill()
|
||||||
self._process.wait()
|
self._get_process().wait()
|
||||||
except (AttributeError, TypeError):
|
except (AttributeError, TypeError):
|
||||||
# If the Python process is terminating, it will remove some modules
|
# If the Python process is terminating, it will remove some modules
|
||||||
# earlier than others and in general it's unclear how to deal with
|
# 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
|
data = evaluator_id, function, args, kwargs
|
||||||
try:
|
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:
|
except (socket.error, IOError) as e:
|
||||||
# Once Python2 will be removed we can just use `BrokenPipeError`.
|
# Once Python2 will be removed we can just use `BrokenPipeError`.
|
||||||
# Also, somehow in windows it returns EINVAL instead of EPIPE if
|
# Also, somehow in windows it returns EINVAL instead of EPIPE if
|
||||||
@@ -239,10 +238,10 @@ class CompiledSubprocess(object):
|
|||||||
% self._executable)
|
% self._executable)
|
||||||
|
|
||||||
try:
|
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:
|
except EOFError as eof_error:
|
||||||
try:
|
try:
|
||||||
stderr = self._process.stderr.read().decode('utf-8', 'replace')
|
stderr = self._get_process().stderr.read().decode('utf-8', 'replace')
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
stderr = '<empty/not available (%r)>' % exc
|
stderr = '<empty/not available (%r)>' % exc
|
||||||
self._kill()
|
self._kill()
|
||||||
|
|||||||
Reference in New Issue
Block a user