Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Melt the second wheel lookup error into sentinel
  • Loading branch information
webknjaz committed Jan 25, 2024
commit 2472d87e87aaa13405b21c01bb23af188731ae74
9 changes: 5 additions & 4 deletions Lib/ensurepip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@

def _find_wheel_pkg_dir_pip():
Comment thread
webknjaz marked this conversation as resolved.
if _WHEEL_PKG_DIR is None:
# NOTE: The compile-time `WHEEL_PKG_DIR` is unset so there is no place
# NOTE: for looking up the wheels.
return None

dist_matching_wheels = _WHEEL_PKG_DIR.glob('pip-*.whl')
try:
last_matching_dist_wheel = sorted(dist_matching_wheels)[-1]
except IndexError as index_err:
raise LookupError(
'`WHEEL_PKG_DIR` does not contain any wheel files for `pip`.',
) from index_err
except IndexError:
# NOTE: `WHEEL_PKG_DIR` does not contain any wheel files for `pip`.
return None
Comment thread
webknjaz marked this conversation as resolved.

return nullcontext(last_matching_dist_wheel)

Expand Down