Title: `types.GenericAlias` has extra `__copy__` and `__deepcopy__` in `__dir__` · Issue #105487 · python/cpython · GitHub
Open Graph Title: `types.GenericAlias` has extra `__copy__` and `__deepcopy__` in `__dir__` · Issue #105487 · python/cpython
X Title: `types.GenericAlias` has extra `__copy__` and `__deepcopy__` in `__dir__` · Issue #105487 · python/cpython
Description: Repro: >>> type A[X] = list[X] >>> dir(A[int]) [..., '__copy__', '__deepcopy__', ...] We can access all other attributes, but not __copy__ and __deepcopy__: >>> A[int].__copy__ Traceback (most recent call last): File "
Open Graph Description: Repro: >>> type A[X] = list[X] >>> dir(A[int]) [..., '__copy__', '__deepcopy__', ...] We can access all other attributes, but not __copy__ and __deepcopy__: >>> A[int].__copy__ Traceback (most rece...
X Description: Repro: >>> type A[X] = list[X] >>> dir(A[int]) [..., '__copy__', '__deepcopy__', ...] We can access all other attributes, but not __copy__ and __deepcopy__: >&g...
Opengraph URL: https://github.com/python/cpython/issues/105487
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`types.GenericAlias` has extra `__copy__` and `__deepcopy__` in `__dir__`","articleBody":"Repro:\n\n```python\n\u003e\u003e\u003e type A[X] = list[X]\n\u003e\u003e\u003e dir(A[int])\n[..., '__copy__', '__deepcopy__', ...]\n```\n\nWe can access all other attributes, but not `__copy__` and `__deepcopy__`:\n\n```pytb\n\u003e\u003e\u003e A[int].__copy__\nTraceback (most recent call last):\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\nAttributeError: 'types.GenericAlias' object has no attribute '__copy__'. Did you mean: '__doc__'?\n\n\u003e\u003e\u003e A[int].__deepcopy__\nTraceback (most recent call last):\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\nAttributeError: 'types.GenericAlias' object has no attribute '__deepcopy__'\n```\n\nI am not quite sure what is the right thing to do here 🤔 \n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-138578\n* gh-138629\n* gh-138640\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2023-06-08T05:32:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/105487/cpython/issues/105487"}
| 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:092aea19-e2c0-8d78-6c31-713c51715cb6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B11E:2B1AB1:1F08262:28B6A73:696B45F0 |
| html-safe-nonce | 4fa4ba8b49059905b933afda8aab601de2aaf49b910a29549c7bae2ac6353001 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTFFOjJCMUFCMToxRjA4MjYyOjI4QjZBNzM6Njk2QjQ1RjAiLCJ2aXNpdG9yX2lkIjoiNDIxMjM0NDM5MzQyMDE5NTMxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1f9947e55eeace180a2d93490dd1c112be43cf3d2408c6806b239c38c32f160f |
| hovercard-subject-tag | issue:1747113557 |
| 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/105487/issue_layout |
| twitter:image | https://opengraph.githubassets.com/db4568d14787d316df1d82f93e631a3cd527fa520311f1a8fc5f0fcdbd0c254c/python/cpython/issues/105487 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/db4568d14787d316df1d82f93e631a3cd527fa520311f1a8fc5f0fcdbd0c254c/python/cpython/issues/105487 |
| og:image:alt | Repro: >>> type A[X] = list[X] >>> dir(A[int]) [..., '__copy__', '__deepcopy__', ...] We can access all other attributes, but not __copy__ and __deepcopy__: >>> A[int].__copy__ Traceback (most rece... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| 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 | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width