Skip to content

🐛 fix(discovery): don't probe PATH directories as interpreters - #247

Open
qodelicious wants to merge 1 commit into
tox-dev:mainfrom
qodelicious:fix-skip-path-dir-probe
Open

qodelicious wants to merge 1 commit into
tox-dev:mainfrom
qodelicious:fix-skip-path-dir-probe

Conversation

@qodelicious

Copy link
Copy Markdown

iter_interpreters() with no key builds an empty PythonSpec(""), so in path_exe_finder the literal-name check does path / "", which is just the PATH directory. It exists, so every PATH entry gets handed to PathPythonInfo.from_exe as if it were an interpreter. Each one fails with Permission denied and is retried once, so on a normal PATH that's two wasted subprocesses per directory, plus noise in the debug log like

failed to query /usr/bin with code 13 err: 'Permission denied'

The check now uses is_file() instead of exists(), so only an actual file with that name is probed. It still follows symlinks like before.

Added a test with a PATH holding one python3.99 and no key. It asserts only that file gets probed. It fails on main (the directory shows up first) and passes with the fix.

This branch has not been deployed

No deployments
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