GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-143387: Raise an exception instead of returning None when metadata file is missing. by jaraco · Pull Request #146234 · python/cpython

Conversation

@jaraco

@jaraco jaraco commented Mar 20, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Syncs changes from importlib_metadata 9.0

  • Issue: Regression: importlib.metadata.PathDistribution.requires raises AttributeError, name/version raises TypeError #143387

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jaraco
Raise an exception instead of returning None when metadata file is mi…
12bffff
…ssing.

Syncs changes from importlib_metadata 9.0
@jaraco
jaraco requested review from FFY00 and warsaw as code owners March 20, 2026 20:14
@bedevere-app bedevere-app Bot added the awaiting core review label Mar 20, 2026
@jaraco
Add blurb
8b81efd
@jaraco jaraco changed the title Raise an exception instead of returning None when metadata file is missing. gh-143387: Raise an exception instead of returning None when metadata file is missing. Mar 20, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Mar 20, 2026
Regression: importlib.metadata.PathDistribution.requires raises AttributeError, name/version raises TypeError #143387
Closed
@jaraco

jaraco commented Mar 23, 2026

Copy link
Copy Markdown
Member Author

Merging to get early feedback. Note from the issue, if this change causes significant disruption, we may opt to add a compatibility shim and deprecation period. Please comment in #143387 if this behavior affects your usage, especially if it's not readily mitigated with your own compatibility shim or use of importlib_metadata>=9.0 on older Pythons.

stonebig reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jaraco
jaraco merged commit f5d47fc into python:main Mar 23, 2026
47 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting core review label Mar 23, 2026
CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request Mar 23, 2026
@CuriousLearner
Merge branch 'main' of github.com:python/cpython into fix-pythongh-13…
3e05fa3
…8577

* 'main' of github.com:python/cpython:
  pythongh-146197: Run -m test.pythoninfo on the Emscripten CI (python#146332)
  pythongh-146325: Use `test.support.requires_fork` in test_fastpath_cache_cleared_in_forked_child (python#146330)
  pythongh-146197: Add Emscripten to CI (python#146198)
  pythongh-143387: Raise an exception instead of returning None when metadata file is missing. (python#146234)
  pythongh-108907: ctypes: Document _type_ codes (pythonGH-145837)
  pythongh-146175: Soft-deprecate outdated macros; convert internal usage (pythonGH-146178)
  pythongh-146056: Rework ref counting in treebuilder_handle_end() (python#146167)
  Add a warning about untrusted input to `configparser` docs (python#146276)
  pythongh-145264: Do not ignore excess Base64 data after the first padded quad (pythonGH-145267)
  pythongh-146308: Fix error handling issues in _remote_debugging module (python#146309)
  pythongh-146192: Add base32 support to binascii (pythonGH-146193)
  pythongh-135953: Properly obtain main thread identifier in Gecko Collector (python#146045)
  pythongh-143414: Implement unique reference tracking for JIT, optimize unpacking of such tuples (pythonGH-144300)
  pythongh-146261: Fix bug in `_Py_uop_sym_set_func_version` (pythonGH-146291)
  pythongh-145144: Add more tests for UserList, UserDict, etc (pythonGH-145145)
  pythongh-143959: Fix test_datetime if _datetime is unavailable (pythonGH-145248)
  pythongh-146245: Fix reference and buffer leaks via audit hook in socket module (pythonGH-146248)
  pythongh-140049: Colorize exception notes in `traceback.py` (python#140051)
  Update docs for pythongh-146056 (pythonGH-146213)
hroncok added a commit to hroncok/rpmlint that referenced this pull request Apr 2, 2026
@hroncok
test: Add PKG-INFO to egg-info mocks for Python 3.15 compatibility
25abd40
Python 3.15's importlib.metadata now strictly requires PKG-INFO files
in egg-info directories when accessing the requires property. Without it,
self.metadata is None and triggers AttributeError when reading d.requires.
Although reported as a regression, upstream chose to enforce this requirement
rather than handle missing metadata gracefully.

python/cpython#143387

In near future, it will raise MetadataNotFound(FileNotFoundError).

python/cpython#146234
@hroncok hroncok mentioned this pull request Apr 2, 2026
test: Add PKG-INFO to egg-info mocks for Python 3.15 compatibility rpm-software-management/rpmlint#1488
Merged
Conan-Kudo pushed a commit to rpm-software-management/rpmlint that referenced this pull request Apr 2, 2026
@hroncok @Conan-Kudo
test: Add PKG-INFO to egg-info mocks for Python 3.15 compatibility
ccb7257
Python 3.15's importlib.metadata now strictly requires PKG-INFO files
in egg-info directories when accessing the requires property. Without it,
self.metadata is None and triggers AttributeError when reading d.requires.
Although reported as a regression, upstream chose to enforce this requirement
rather than handle missing metadata gracefully.

python/cpython#143387

In near future, it will raise MetadataNotFound(FileNotFoundError).

python/cpython#146234
@pablogsal pablogsal mentioned this pull request Apr 4, 2026
gh-130273: Fix traceback color output with unicode characters #142529
Merged
@KRRT7 KRRT7 mentioned this pull request Apr 9, 2026
Fix test_trailing_slash_directory_metadata for Python 3.15 pypa/pip#13902
Merged
2 tasks done
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@jaraco @ljfp
pythongh-143387: Raise an exception instead of returning None when me…
22d57db
…tadata file is missing. (python#146234)
frenzymadness added a commit to frenzymadness/poetry that referenced this pull request Apr 27, 2026
@frenzymadness
Fix MetadataNotFound from importlib.metadata on Python 3.15+
fe89725
In Python 3.15, importlib.metadata raises MetadataNotFound
(a FileNotFoundError subclass) when a dist-info directory has no
METADATA file. Previously, it returned None.

CPython change: python/cpython#146234
@frenzymadness frenzymadness mentioned this pull request Apr 27, 2026
Fix MetadataNotFound from importlib.metadata on Python 3.15+ python-poetry/poetry#10860
Merged
radoering pushed a commit to frenzymadness/poetry that referenced this pull request May 1, 2026
@frenzymadness @radoering
Fix MetadataNotFound from importlib.metadata on Python 3.15+
41ec955
In Python 3.15, importlib.metadata raises MetadataNotFound
(a FileNotFoundError subclass) when a dist-info directory has no
METADATA file. Previously, it returned None.

CPython change: python/cpython#146234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@warsaw warsaw Awaiting requested review from warsaw warsaw is a code owner
@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@jaraco
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.