You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason this fails on windows is because the python.exe used by tox is not attachable. The python.exe doesn't load the CPython dll, it looks like it's a statically linked version of python.
I dumped the modules loaded into the debuggee when it was failing and I got this:
On Windows, when you have a virtual environment, python.exe (and also all the tools in Scripts) are small shims that spawn the actual Python binary from the base environment, because symlinks cannot be assumed to be safe to use for non-admin users, unlike on Unix. Hence why in those cases attach doesn't work - it can only see a child Python process if it is debugging the parent Python process that spawns it, but those shims aren't Python processes.
However it is unclear to me why this isn't (or at least wasn't) a consistent repro, if that is indeed the problem. Perhaps it might be using symlinks instead of shims depending on how the machine is configured?
Activity
Disable test_attach_pid_client on Windows and macOS per #311
rchiodo commentedon Jul 26, 2024
The reason this fails on windows is because the python.exe used by tox is not attachable. The python.exe doesn't load the CPython dll, it looks like it's a statically linked version of python.
I dumped the modules loaded into the debuggee when it was failing and I got this:
And then looking at that Python.exe, it doesn't have a dependency on the python311.dll.
rchiodo commentedon Jul 26, 2024
On linux this is flakey for me too. When it fails it seems to be gdb not being able to inject.
int19h commentedon Jul 27, 2024
On Windows, when you have a virtual environment, python.exe (and also all the tools in Scripts) are small shims that spawn the actual Python binary from the base environment, because symlinks cannot be assumed to be safe to use for non-admin users, unlike on Unix. Hence why in those cases attach doesn't work - it can only see a child Python process if it is debugging the parent Python process that spawns it, but those shims aren't Python processes.
However it is unclear to me why this isn't (or at least wasn't) a consistent repro, if that is indeed the problem. Perhaps it might be using symlinks instead of shims depending on how the machine is configured?