gh-148932: Fix profiling.sampling on Windows virtual environments#150541
Conversation
Documentation build overview
105 files changed ·
|
chris-eibl
left a comment
There was a problem hiding this comment.
I've just verified locally that it works in a virtual environment now, so approving.
Thanks for your contribution @edvilme!
I'd even backport to 3.15 (rather a bug fix than a feature IMO), but leave the final decision to @pablogsal.
|
Hi @chris-eibl thank you!! |
|
No, thanks. Let's wait for Pablo's decision first, and then most probably |
|
Please address that nit and ping me again so I or @chris-eibl can land |
|
Renamed method to |
|
Thanks @edvilme for the PR, and @chris-eibl for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
GH-151097 is a backport of this pull request to the 3.15 branch. |
Currently, it is not possible to run
profiling.samplingfrom a Windows venv because virtual environments use shims to launch the original interpreter, but the shim itself isn't a real Python process.Fix
Added
_resolve_venv_childfunction to detect when the profiler is started from a virtual environment process on Windows, and automatically redirect it to the real child Python process. This prevents profiling against the shim instead of the actual Python process.The
SampleProfilerclass uses the resolved child PID when initializing.Before
After
CC @pablogsal