Skip to content

Conversation

@esafak
Copy link
Contributor

@esafak esafak commented Jul 31, 2025

  • Fix a crash that occurred when the PATH environment variable contained a file instead of a directory.
  • Add a check to ensure only directories are processed from the PATH.
  • Preserve existing behavior of skipping unreadable or empty directories.
  • Add a test case to verify that a file in PATH does not cause a crash.
  • Add additional tests to improve code coverage.

Fixes #2861

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

google-labs-jules bot and others added 3 commits July 31, 2025 18:24
*   Fix a crash that occurred when the PATH environment variable contained a file instead of a directory.
*   Add a check to ensure only directories are processed from the PATH.
*   Preserve existing behavior of skipping unreadable or empty directories.
*   Add a test case to verify that a file in PATH does not cause a crash.
*   Add additional tests to improve code coverage.

Fixes pypa#2861

Signed-off-by: Emre Şafak <3928300+esafak@users.noreply.github.com>
…e contained a file. This was happening because I was trying to read the contents of the file as if it were a directory.

To fix this, I'll now check to make sure that each entry in the PATH is a directory before I try to read from it. This will also preserve the original behavior of skipping unreadable or empty directories.

I've also added a new test case to make sure that a file in the PATH doesn't cause a crash. I've also added some additional tests to improve code coverage and to fix a platform-specific issue in the test suite.
@gaborbernat gaborbernat merged commit 19796cf into pypa:main Aug 1, 2025
42 checks passed
@esafak esafak deleted the fix/path-discovery-2861 branch August 1, 2025 00:07
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.

[bug][windows] failiing if there is an exe in path

2 participants