Skip to content

✨ feat(info): expose debug build status#79

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:add-debug-build
May 28, 2026
Merged

✨ feat(info): expose debug build status#79
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:add-debug-build

Conversation

@gaborbernat
Copy link
Copy Markdown
Member

CPython venv on Windows handles debug builds by looking for python_d.exe and venvlauncher_d.exe, but virtualenv has no way to detect whether a target interpreter is a debug build. 🔍 This blocks virtualenv from matching CPython venv's behavior for debug Python installations.

PythonInfo now reads Py_DEBUG from sysconfig (following the same pattern as free_threaded / Py_GIL_DISABLED) and exposes it as debug_build. The spec property includes a d suffix for debug interpreters, and _find_possible_exe_names generates _d executable name variants so discovery can locate debug builds on Windows.

Cache compatibility requires no special handling. The caching layer hashes _py_info.py to detect staleness, so adding the new field automatically invalidates old cache entries and forces a fresh probe. New cache entries read by older python-discovery versions are also safe since from_dict assigns all dict keys to __dict__ and the extra debug_build key is silently ignored.

virtualenv needs to know whether a target interpreter is a debug
build to correctly handle Windows debug executables (python_d.exe,
venvlauncher_d.exe), matching CPython venv behavior.

Cache compatibility is automatic: _py_info.py is hashed by the
caching layer, so adding a new field changes the hash and forces
re-probe of stale entries.

Also flattened _find_possible_exe_names with itertools.product to
stay within the nesting limit after adding debug suffix variants.
@gaborbernat gaborbernat merged commit 0545a47 into tox-dev:main May 28, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant