Skip to content

Commit 45f9944

Browse files
committed
Melt the second wheel lookup error into sentinel
1 parent 446a2ab commit 45f9944

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Lib/ensurepip/__init__.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@
2424

2525
def _find_wheel_pkg_dir_pip():
2626
if _WHEEL_PKG_DIR is None:
27+
# NOTE: The compile-time `WHEEL_PKG_DIR` is unset so there is no place
28+
# NOTE: for looking up the wheels.
2729
return None
2830

2931
dist_matching_wheels = _WHEEL_PKG_DIR.glob('pip-*.whl')
3032
try:
3133
last_matching_dist_wheel = sorted(dist_matching_wheels)[-1]
32-
except IndexError as index_err:
33-
raise LookupError(
34-
'`WHEEL_PKG_DIR` does not contain any wheel files for `pip`.',
35-
) from index_err
34+
except IndexError:
35+
# NOTE: `WHEEL_PKG_DIR` does not contain any wheel files for `pip`.
36+
return None
3637

3738
return nullcontext(last_matching_dist_wheel)
3839

0 commit comments

Comments
 (0)