From d4ec4fa3c8cf16beb4f8379f5b96d7d54a70cf2a Mon Sep 17 00:00:00 2001 From: Zo Bot Date: Tue, 23 Jun 2026 23:51:51 +0000 Subject: [PATCH] narrow _monitor_process except clause to KeyError The bare `except:` in ProcessManager._monitor_process was catching every exception and silently swallowing it. The only operations inside the try block are dict del/pop (which raise KeyError) and JsonRpc.close() which already wraps its operations in `contextlib.suppress(Exception)` and therefore cannot raise. Replacing the bare except with `except KeyError` makes the failure mode visible to a future maintainer who introduces a new call inside the try block that could raise an unrelated exception type. --- bundled/tool/lsp_jsonrpc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundled/tool/lsp_jsonrpc.py b/bundled/tool/lsp_jsonrpc.py index 4e8fb1f0..4261a10c 100644 --- a/bundled/tool/lsp_jsonrpc.py +++ b/bundled/tool/lsp_jsonrpc.py @@ -181,7 +181,8 @@ def _monitor_process(): del self._processes[workspace] rpc = self._rpc.pop(workspace) rpc.close() - except: # pylint: disable=bare-except + except KeyError: + # KeyError is sufficient because the process is already dead pass self._thread_pool.submit(_monitor_process)