From a0527a5af598d78a0948c5316a405065e6085a71 Mon Sep 17 00:00:00 2001 From: Peter Law Date: Sat, 29 Jun 2024 21:41:21 +0100 Subject: [PATCH] Pass through the inference state id rather than recomputing it This removes some of the coupling between the management of the underlying process and the inference state itself, which intends to enable changing the origin of the id. This will be useful in the next commit. --- jedi/inference/compiled/subprocess/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jedi/inference/compiled/subprocess/__init__.py b/jedi/inference/compiled/subprocess/__init__.py index cd5fe74c..76dba694 100644 --- a/jedi/inference/compiled/subprocess/__init__.py +++ b/jedi/inference/compiled/subprocess/__init__.py @@ -128,7 +128,7 @@ class InferenceStateSubprocess(_InferenceStateProcess): self._used = True result = self._compiled_subprocess.run( - self._inference_state_weakref(), + self._inference_state_id, func, args=args, kwargs=kwargs, @@ -213,18 +213,18 @@ class CompiledSubprocess: t) return process - def run(self, inference_state, function, args=(), kwargs={}): + def run(self, inference_state_id, function, args=(), kwargs={}): # Delete old inference_states. while True: try: - inference_state_id = self._inference_state_deletion_queue.pop() + delete_id = self._inference_state_deletion_queue.pop() except IndexError: break else: - self._send(inference_state_id, None) + self._send(delete_id, None) assert callable(function) - return self._send(id(inference_state), function, args, kwargs) + return self._send(inference_state_id, function, args, kwargs) def get_sys_path(self): return self._send(None, functions.get_sys_path, (), {})