Skip to content

🐛 fix(seed): fail --upgrade-embed-wheels when an upgrade fails - #3588

Merged
gaborbernat merged 2 commits into
pypa:mainfrom
Pratik-Kumar-Dhakar:fix/upgrade-embed-wheels-exit-code
Nov 20, 2026
Merged

gaborbernat merged 2 commits into
pypa:mainfrom
Pratik-Kumar-Dhakar:fix/upgrade-embed-wheels-exit-code

Conversation

@Pratik-Kumar-Dhakar

@Pratik-Kumar-Dhakar Pratik-Kumar-Dhakar commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3583

manual_upgrade now returns 1 when any upgrade failed, and 0 otherwise. The existing raise SystemExit(manual_upgrade(...)) turns that into the exit status. Each thread catches its own failure and logs one could not upgrade <dist> for python <ver>: ... error, including pip's stderr when there is one, instead of printing a thread traceback.

With PIP_NO_INDEX=1, the command now exits 1 with no tracebacks; it used to exit 0 with 16. Tests:

  • a new case where pip's download fails for one distribution;
  • the existing success case now also checks the return value;
  • the CLI test is parametrised over both exit statuses.

Security scope: this touches the wheel-download path, but only the error handling after pip download fails. No outside input is newly read. The logged stderr is pip's output, written to the log as data and never executed.

Thanks for contributing, make sure you address all the checklists (for details on how see development documentation)

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added a docs/changelog/+short-description.<type>.rst fragment for each user-facing change, or applied skip news
  • updated/extended the documentation
  • for changes to activation scripts, pyvenv.cfg, wheel downloads, app-data or release workflows: explained in the PR text which outside input the change handles
  • ran tests on Python 3.9 and 3.15 (the affected test modules, with pytest in 3.9 and 3.15 environments rather than through tox. On 3.9, one fixture-teardown error also happens on main in my environment)
  • linked upstream issues beside any temporary interpreter overrides
  • kept the PR in draft until CI passes

@Pratik-Kumar-Dhakar
Pratik-Kumar-Dhakar marked this pull request as ready for review November 19, 2026 16:58
Pratik-Kumar-Dhakar and others added 2 commits November 19, 2026 17:10
Report failed upgrades and exit 1 when any worker fails. Thread exceptions previously left the command with status 0.
The lazy import placeholder is non-callable in isolated Windows runs,
so autospec made the CLI test fail before the upgrade path ran. Keep
the exit status and invocation assertions. Correct the changelog claim
because pip stderr may span lines.
@gaborbernat
gaborbernat force-pushed the fix/upgrade-embed-wheels-exit-code branch from c612af6 to d4cd886 Compare November 20, 2026 01:15
@gaborbernat
gaborbernat merged commit 8bda5b7 into pypa:main Nov 20, 2026
82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--upgrade-embed-wheels exits 0 when upgrades fail and prints a thread traceback for each

2 participants