Title: Regression: importlib.metadata.PathDistribution.requires raises AttributeError, name/version raises TypeError · Issue #143387 · python/cpython · GitHub
Open Graph Title: Regression: importlib.metadata.PathDistribution.requires raises AttributeError, name/version raises TypeError · Issue #143387 · python/cpython
X Title: Regression: importlib.metadata.PathDistribution.requires raises AttributeError, name/version raises TypeError · Issue #143387 · python/cpython
Description: Bug report Bug description: Python 3.14.2 >>> from importlib import metadata >>> d = metadata.PathDistribution.at('/tmp') >>> d.requires >>> d.requires is None True Python 3.15.0a3 >>> from importlib import metadata >>> d = metadata.Path...
Open Graph Description: Bug report Bug description: Python 3.14.2 >>> from importlib import metadata >>> d = metadata.PathDistribution.at('/tmp') >>> d.requires >>> d.requires is None True Python 3.15.0a3 >>> from importl...
X Description: Bug report Bug description: Python 3.14.2 >>> from importlib import metadata >>> d = metadata.PathDistribution.at('/tmp') >>> d.requires >>> d.requires i...
Opengraph URL: https://github.com/python/cpython/issues/143387
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regression: importlib.metadata.PathDistribution.requires raises AttributeError, name/version raises TypeError","articleBody":"# Bug report\n\n### Bug description:\n\n## Python 3.14.2\n\n```pycon\n\u003e\u003e\u003e from importlib import metadata\n\u003e\u003e\u003e d = metadata.PathDistribution.at('/tmp')\n\u003e\u003e\u003e d.requires\n\u003e\u003e\u003e d.requires is None\nTrue\n```\n\n## Python 3.15.0a3\n\n```pycon\n\u003e\u003e\u003e from importlib import metadata\n\u003e\u003e\u003e d = metadata.PathDistribution.at('/tmp')\n\u003e\u003e\u003e d.requires\nTraceback (most recent call last):\n File \"\u003cpython-input-2\u003e\", line 1, in \u003cmodule\u003e\n d.requires\n File \"/usr/lib64/python3.15/importlib/metadata/__init__.py\", line 660, in requires\n reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs()\n ~~~~~~~~~~~~~~~~~~~~~~~~~^^\n File \"/usr/lib64/python3.15/importlib/metadata/__init__.py\", line 664, in _read_dist_info_reqs\n return self.metadata.get_all('Requires-Dist')\n ^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'get_all'\n```\n\nI believe this is a regression from 9b38c6698a3d6e7b37279dd9ae0d4d6430f9c612 where the `metadata` property changed the type from `_meta.PackageMetadata` to `_meta.PackageMetadata | None` but other properties (here the `requires` property) do not account for it being `None`.\n\nThis was discovered as a failure of tests of rpmlint in Fedora's continuous testing of Python pre-releases: https://bugzilla.redhat.com/show_bug.cgi?id=2424585\n\n### CPython versions tested on:\n\n3.15\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-146234\n* gh-150095\n* gh-150106\n* gh-150169\n* gh-150171\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/hroncok","@type":"Person","name":"hroncok"},"datePublished":"2026-01-03T11:13:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":36},"url":"https://github.com/143387/cpython/issues/143387"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8fe8ebca-9047-58cf-56f7-d0b41d031397 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EE44:7C22D:215EF8E:2E67C5D:6A50B9AA |
| html-safe-nonce | 9d3596628376e24673255687b51603eea589762d399e30cc8e5b9cc664aeffbb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRTQ0OjdDMjJEOjIxNUVGOEU6MkU2N0M1RDo2QTUwQjlBQSIsInZpc2l0b3JfaWQiOiI4ODk1OTU1NDU0NjE5ODU5MzcwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6d72a6c629a3c55443b37dcdbb4f7f3a74183beb285e31b2933282d22f13e555 |
| hovercard-subject-tag | issue:3777968678 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/143387/issue_layout |
| twitter:image | https://opengraph.githubassets.com/93a13873da0b05267a8f5f39f245b60afc1872c952083189af0d62b8674974d2/python/cpython/issues/143387 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/93a13873da0b05267a8f5f39f245b60afc1872c952083189af0d62b8674974d2/python/cpython/issues/143387 |
| og:image:alt | Bug report Bug description: Python 3.14.2 >>> from importlib import metadata >>> d = metadata.PathDistribution.at('/tmp') >>> d.requires >>> d.requires is None True Python 3.15.0a3 >>> from importl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hroncok |
| hostname | github.com |
| expected-hostname | github.com |
| None | 63772747707af4093f0d5fc7aa1bb3bb55f412a9865207c4f421aa34c64cc404 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ded53fe94e3ff1bb4dbf8cc77e285396c92580fb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width