Skip to content

profiling.sampling doesn't work under venv on Windows #148932

@sergey-miryanov

Description

@sergey-miryanov

Bug report

Bug description:

Running the following command inside a virtual environment triggers this error on Windows:
Failed to find the PyRuntime section in process 29072 on Windows platform

python -m profiling.sampling run --subprocesses -m test test_gc

I suspect this happens because virtual environments use shims to launch the original interpreter. Since the shim itself isn't a Python process, that's why profiling.sampling fails.

We can work around this: if --subprocesses option specified then we should proceed with profiling as long as at least one child process is a Python process.

cc @pablogsal

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions