Title: Reflect it that `sys.lazy_modules` is no longer a flat set · Issue #145057 · python/cpython · GitHub
Open Graph Title: Reflect it that `sys.lazy_modules` is no longer a flat set · Issue #145057 · python/cpython
X Title: Reflect it that `sys.lazy_modules` is no longer a flat set · Issue #145057 · python/cpython
Description: Bug report Bug description: sys.lazy_modules is now a dict[str, set[str]], not a flat set. There's some places in the stdlib code that incorrectly suggests the older invariant. Most notable example: cpython/Lib/test/test_import/test_lazy...
Open Graph Description: Bug report Bug description: sys.lazy_modules is now a dict[str, set[str]], not a flat set. There's some places in the stdlib code that incorrectly suggests the older invariant. Most notable example...
X Description: Bug report Bug description: sys.lazy_modules is now a dict[str, set[str]], not a flat set. There's some places in the stdlib code that incorrectly suggests the older invariant. Most notable exa...
Opengraph URL: https://github.com/python/cpython/issues/145057
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Reflect it that `sys.lazy_modules` is no longer a flat set","articleBody":"# Bug report\n\n### Bug description:\n\n`sys.lazy_modules` is now a `dict[str, set[str]]`, not a flat set. There's some places in the stdlib code that incorrectly suggests the older invariant.\n\nMost notable example:\n\nhttps://github.com/python/cpython/blob/70da972f97ec799dc7d7ab069fe195455f2f81b2/Lib/test/test_import/test_lazy_imports.py#L457-L459\n\nThe PEP needs updating as well -- https://peps.python.org/pep-0810/#lazy-import-mechanism -- @DinoV, I think this is something you were working on, or is it open for contrib?\n\nI'm happy to pick this one up (i.e. fixing our code to reflect `sys.lazy_modules` is a dict) if you'd like that! (Please reassign otherwise.)\n\ncc @pablogsal @DinoV @brittanyrey @Yhg1s\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-146084\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/johnslavik","@type":"Person","name":"johnslavik"},"datePublished":"2026-02-20T23:17:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/145057/cpython/issues/145057"}
| 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:64459fab-a0ef-fb93-cb40-bc9a8a5ef309 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD32:30A6D1:58FCDE:81BF75:6A560FEB |
| html-safe-nonce | dfe307d3991f4ddda0396dbc6b2f5f68e9831b6b2c3bead09460c04bcee7f76a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDMyOjMwQTZEMTo1OEZDREU6ODFCRjc1OjZBNTYwRkVCIiwidmlzaXRvcl9pZCI6IjIxNTcwMjk4NzYwMjQzNDg2NTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fbac1011001beea48d64bd346398870694dbd69853fac6885309579506d71caa |
| hovercard-subject-tag | issue:3970762758 |
| 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/145057/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c1d9c8036f9e502e3d2e6f1eebba4fa61c3b81ec52198599626a7cc56a122edc/python/cpython/issues/145057 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c1d9c8036f9e502e3d2e6f1eebba4fa61c3b81ec52198599626a7cc56a122edc/python/cpython/issues/145057 |
| og:image:alt | Bug report Bug description: sys.lazy_modules is now a dict[str, set[str]], not a flat set. There's some places in the stdlib code that incorrectly suggests the older invariant. Most notable example... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | johnslavik |
| hostname | github.com |
| expected-hostname | github.com |
| None | f4368738fc918fecd9b3958f6b49218bbe60d4185f38e72e3954e11f1ad0213a |
| 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 | 85a7179838b41e8b23f939d3b67b53f752ecfc54 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width