From d278387522daf9639d2305fa6be2312ded077270 Mon Sep 17 00:00:00 2001 From: Alan Fleming <> Date: Sun, 19 Oct 2025 07:49:28 +1100 Subject: [PATCH] Ensure debugInfo is fullly populated. --- src/async_kernel/debugger.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/async_kernel/debugger.py b/src/async_kernel/debugger.py index b9b60d6..736bd5c 100644 --- a/src/async_kernel/debugger.py +++ b/src/async_kernel/debugger.py @@ -26,17 +26,14 @@ os.environ["PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING"] = "1" # This import is required to provide _pydevd_bundle imports - from debugpy.server import api # noqa: F401 # pyright: ignore[reportUnusedImport] + import debugpy.server.api # pyright: ignore[reportUnusedImport] # noqa: F401 - _is_debugpy_available = True except ImportError: - _is_debugpy_available = False + pass except Exception as e: # We cannot import the module where the DebuggerInitializationError # is defined - if e.__class__.__name__ == "DebuggerInitializationError": - _is_debugpy_available = False - else: + if e.__class__.__name__ != "DebuggerInitializationError": raise _host_port: None | tuple[str, int] = None @@ -332,8 +329,6 @@ async def do_initialize(self, msg: DebugMessage, /): async def do_debug_info(self, msg: DebugMessage, /): """Handle a debug info message.""" - if not _is_debugpy_available or utils.LAUNCHED_BY_DEBUGPY: - return {} breakpoint_list = [] for key, value in self.breakpoint_list.items(): breakpoint_list.append({"source": key, "breakpoints": value}) @@ -344,7 +339,7 @@ async def do_debug_info(self, msg: DebugMessage, /): "success": True, "command": msg["command"], "body": { - "isStarted": self.debugpy_client.connected, + "isStarted": self.debugpy_client.connected and not utils.LAUNCHED_BY_DEBUGPY, "hashMethod": compiler.hash_method, "hashSeed": compiler.hash_seed, "tmpFilePrefix": compiler.tmp_file_prefix,