Skip to content

Commit aa22b55

Browse files
committed
gh-143387: Update docs to reflect the behavior and note the changed version.
1 parent 51a5715 commit aa22b55

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Doc/library/importlib.metadata.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ Distribution metadata
224224
Raises :exc:`PackageNotFoundError` if the named distribution
225225
package is not installed in the current Python environment.
226226

227+
Raises :exc:`MetadataNotFound` if a distribution package is
228+
present but no METADATA file is present.
229+
227230
.. class:: PackageMetadata
228231

229232
A concrete implementation of the
@@ -252,6 +255,12 @@ all the metadata in a JSON-compatible form per :PEP:`566`::
252255
The full set of available metadata is not described here.
253256
See the PyPA `Core metadata specification <https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata>`_ for additional details.
254257

258+
.. versionchanged:: 3.15
259+
Previously and incidentally, if a METADATA file was missing from a distribution, an
260+
empty ``PackageMetadata`` would be returned, indistinguishable from
261+
an empty METADATA file. Now, a missing METADATA file triggers a
262+
``MetadataNotFound`` exception.
263+
255264
.. versionchanged:: 3.10
256265
The ``Description`` is now included in the metadata when presented
257266
through the payload. Line continuation characters have been removed.
@@ -465,6 +474,9 @@ The same applies for :func:`entry_points` and :func:`files`.
465474
.. attribute:: metadata
466475
:type: PackageMetadata
467476

477+
Raises :exc:`MetadataNotFound` if the METADATA file is not present in
478+
the distribution.
479+
468480
There are all kinds of additional metadata available on :class:`!Distribution`
469481
instances as a :class:`PackageMetadata` instance::
470482

0 commit comments

Comments
 (0)