From 4fc89825ea3185dc4b1689292d752ca0805cd0d9 Mon Sep 17 00:00:00 2001 From: Philip DePetro Date: Fri, 14 Aug 2026 10:23:45 -0700 Subject: [PATCH] Check against sys.executable when determining if we should instrument subprocess Native python binaries might not include 'python' in the file basename, causing the multiprocess monkey-patching code in pydevd to not recognize its subprocesses as python processes. Add a fallback check against sys.executable in is_python() so that subprocesses launched via the same executable are correctly instrumented for debugging. This is useful for custom Python builds or embedded distributions where the executable name doesn't contain 'python', 'jython', or 'pypy'. --- src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py b/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py index 09fcadec..814a7685 100644 --- a/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py +++ b/src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py @@ -300,6 +300,9 @@ def is_python(path) -> bool: if filename.find(name) != -1: return True + if path == sys.executable: + return True + return False