Skip to content

Commit 0930237

Browse files
authored
Merge pull request #11318 from q0w/check-binary-exe
2 parents 57c9f62 + 6354192 commit 0930237

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

news/11309.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure that the candidate ``pip`` executable exists, when checking for a new version of pip.

src/pip/_internal/utils/entrypoints.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,14 @@ def get_best_invocation_for_this_pip() -> str:
5555
if exe_are_in_PATH:
5656
for exe_name in _EXECUTABLE_NAMES:
5757
found_executable = shutil.which(exe_name)
58-
if found_executable and os.path.samefile(
59-
found_executable,
60-
os.path.join(binary_prefix, exe_name),
58+
binary_executable = os.path.join(binary_prefix, exe_name)
59+
if (
60+
found_executable
61+
and os.path.exists(binary_executable)
62+
and os.path.samefile(
63+
found_executable,
64+
binary_executable,
65+
)
6166
):
6267
return exe_name
6368

0 commit comments

Comments
 (0)