Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-146310: Fix ensurepip to treat empty WHEEL_PKG_DIR as unset#146357

Open
kimimgo wants to merge 1 commit intopython:mainfrom
kimimgo:fix/ensurepip-empty-wheel-pkg-dir-146310
Open

gh-146310: Fix ensurepip to treat empty WHEEL_PKG_DIR as unset#146357
kimimgo wants to merge 1 commit intopython:mainfrom
kimimgo:fix/ensurepip-empty-wheel-pkg-dir-146310

Conversation

@kimimgo
Copy link

@kimimgokimimgo commentedMar 24, 2026
edited by bedevere-appbot
Loading

Fixes#146310

Path('') resolves to the current working directory (PosixPath('.')), so whenWHEEL_PKG_DIR is an empty string (notNone),ensurepip searches CWD for wheel files. This can cause unexpected behavior or crashes if CWD contains files matchingpip-*.whl.

Changes

  • Lib/ensurepip/__init__.py: Add truthiness check so empty strings are treated the same asNone
  • Lib/test/test_ensurepip.py: Add test verifying emptyWHEEL_PKG_DIR does not search CWD

Before/After

# Before: Path('').resolve() -> PosixPath('/current/working/dir')# Empty string was treated as a valid directory path# After: Empty string treated as None -> use bundled wheel

Path('') resolves to CWD, so an empty WHEEL_PKG_DIR string causedensurepip to search the current working directory for wheel files.Add a truthiness check to treat empty strings the same as None.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@pfmoorepfmooreAwaiting requested review from pfmoorepfmoore is a code owner

@pradyunsgpradyunsgAwaiting requested review from pradyunsgpradyunsg is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

ensurepip looks for wheels in CWD when WHEEL_PKG_DIR is an empty string

1 participant

@kimimgo

[8]ページ先頭

©2009-2026 Movatter.jp