From 92af04390621cb7cfa511c923bd149d60a90ae78 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 2 Jul 2020 18:39:24 +0200 Subject: [PATCH] Fix some subprocess issues --- jedi/_compatibility.py | 2 -- jedi/inference/compiled/subprocess/__init__.py | 13 +------------ 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index 70a67e30..38b701e3 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -4,8 +4,6 @@ different Python versions. """ import errno import sys -import os -import subprocess import pickle diff --git a/jedi/inference/compiled/subprocess/__init__.py b/jedi/inference/compiled/subprocess/__init__.py index fc6125a3..b9c98b37 100644 --- a/jedi/inference/compiled/subprocess/__init__.py +++ b/jedi/inference/compiled/subprocess/__init__.py @@ -11,8 +11,6 @@ import os import sys import queue import subprocess -import socket -import errno import traceback import weakref from functools import partial @@ -206,9 +204,6 @@ class CompiledSubprocess(object): stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - # Use system default buffering on Python 2 to improve performance - # (this is already the case on Python 3). - bufsize=-1, env=self._env_vars ) self._stderr_queue = queue.Queue() @@ -253,13 +248,7 @@ class CompiledSubprocess(object): data = inference_state_id, function, args, kwargs try: pickle_dump(data, self._get_process().stdin, 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 - # the subprocess dies. - if e.errno not in (errno.EPIPE, errno.EINVAL): - # Not a broken pipe - raise + except BrokenPipeError: self._kill() raise InternalError("The subprocess %s was killed. Maybe out of memory?" % self._executable)