Title: Cannot import ``Anchor`` from ``importlib.resources`` · Issue #113238 · python/cpython · GitHub
Open Graph Title: Cannot import ``Anchor`` from ``importlib.resources`` · Issue #113238 · python/cpython
X Title: Cannot import ``Anchor`` from ``importlib.resources`` · Issue #113238 · python/cpython
Description: Bug report Bug description: The Python 3.12 documentation of the standard library module importlib.resources describes the importlib.resources.Anchor class, which is used for the type annotation of the files() function. But in reality An...
Open Graph Description: Bug report Bug description: The Python 3.12 documentation of the standard library module importlib.resources describes the importlib.resources.Anchor class, which is used for the type annotation of...
X Description: Bug report Bug description: The Python 3.12 documentation of the standard library module importlib.resources describes the importlib.resources.Anchor class, which is used for the type annotation of...
Opengraph URL: https://github.com/python/cpython/issues/113238
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot import ``Anchor`` from ``importlib.resources``","articleBody":"# Bug report\n\n### Bug description:\n\nThe Python 3.12 documentation of the standard library module `importlib.resources` describes the [importlib.resources.Anchor](https://docs.python.org/3.12/library/importlib.resources.html#importlib.resources.Anchor) class, which is used for the type annotation of the `files()` function.\nBut in reality `Anchor` is not available to import from `importlib.resources`, it can only by found in `importlib.resources._common` as an alias for `Package` (which is instead available from `importlib.resources`).\n\nTo reproduce:\n\n```python\n>>> from importlib.resources import Anchor\nTraceback (most recent call last):\n File \"\u003cstdin>\", line 1, in \u003cmodule>\nImportError: cannot import name 'Anchor' from 'importlib.resources' (/usr/lib/python3.12/importlib/resources/__init__.py)\n```\n\nExpected result:\nNo `ImportError`\n\nUse case:\nTo add type annotation to a function that receives an anchor and passes it to `files()`.\n\n### CPython versions tested on:\n\n3.12\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-113799\n* gh-113801\n* gh-130499\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/nsoranzo","@type":"Person","name":"nsoranzo"},"datePublished":"2023-12-17T19:12:16Z","url":"https://github.com/python/cpython/issues/113238"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:3e98780c-1721-3429-2154-414cba0c9395 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9EB0:15E5F9:2973A0D:38AFE12:6B00518A |
| html-safe-nonce | c992def26675503d4068bfb56f9b46a49abf30a50294a4a51de5a3691be443fe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUIwOjE1RTVGOToyOTczQTBEOjM4QUZFMTI6NkIwMDUxOEEiLCJ2aXNpdG9yX2lkIjoiODAxMTAxNzUwMjQ1MDUzNjg0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 185790e94a1bf766bb5aa67dc476d462115785b6f32d568f661d637d6cc3be72 |
| hovercard-subject-tag | issue:2045340141 |
| 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/113238/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8ad605e3c6639fae55605e591af03396ea7b755ebf60ce8b7f5cee3399bbbd33/python/cpython/issues/113238 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8ad605e3c6639fae55605e591af03396ea7b755ebf60ce8b7f5cee3399bbbd33/python/cpython/issues/113238 |
| og:image:alt | Bug report Bug description: The Python 3.12 documentation of the standard library module importlib.resources describes the importlib.resources.Anchor class, which is used for the type annotation of... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nsoranzo |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width