Check against sys.executable when determining if we should instrument subprocess - #2065
Check against sys.executable when determining if we should instrument subprocess#2065Philip DePetro (pdepetro) wants to merge 1 commit into
Conversation
… 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'.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
🔒 Automated review in progress — Rich Chiodo (@rchiodo) is auto-reviewing this PR. |
| return True | ||
|
|
||
| if path == sys.executable: | ||
| return True |
There was a problem hiding this comment.
Warning · Non-blocking recommendation
Raw equality accepts only the literal sys.executable spelling, so the same executable invoked through a symlink, relative path, or Windows case variation is still not recognized. Define whether this is intentionally an exact-path contract; if executable identity is intended, use a platform-aware path-equivalence check and cover alternate spellings.
| return True | ||
|
|
||
| if path == sys.executable: | ||
| return True |
There was a problem hiding this comment.
Warning · Non-blocking recommendation
Add a focused regression test that mocks an executable basename without python, jython, or pypy and verifies that is_python() recognizes it through sys.executable. The test should also establish the intended path-equivalence behavior.
Rich Chiodo (rchiodo)
left a comment
There was a problem hiding this comment.
Approved via Review Center.
Heejae Chang (heejaechang)
left a comment
There was a problem hiding this comment.
Approved via Review Center.
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'.