Skip to content

fix: better error message for broken Distribution objects (#508) - #546

Merged
jaraco merged 3 commits into
python:mainfrom
DawnofGenX:main
Oct 21, 2026
Merged

jaraco merged 3 commits into
python:mainfrom
DawnofGenX:main

Conversation

@DawnofGenX

@DawnofGenX DawnofGenX commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #508: Better error message when a Distribution object is broken (missing Name metadata).

Changes

  • property now wraps the with the distribution path context
  • Added test for the new error message

Testing

  • 40/40 tests pass
  • New test verifies the error message contains useful context

Comment thread importlib_metadata/__init__.py Outdated
Comment thread importlib_metadata/__init__.py Outdated
Comment thread importlib_metadata/__init__.py
jaraco and others added 2 commits October 21, 2026 14:43
… path.

Replace the Name-specific handling with an `_identify_dist` decorator
applied to both required metadata accessors, and give PathDistribution a
`__str__` that emits its metadata path so the error (and diagnose) can
rely on rendering the distribution rather than reaching for `_path`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jaraco
jaraco merged commit a7c26f4 into python:main Oct 21, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better identification of broken Distribution objects

2 participants