Title: Merge 'types.UnionType' with `typing._UnionGenericAlias`, not `typing.Union` · Issue #137065 · python/cpython · GitHub
Open Graph Title: Merge 'types.UnionType' with `typing._UnionGenericAlias`, not `typing.Union` · Issue #137065 · python/cpython
X Title: Merge 'types.UnionType' with `typing._UnionGenericAlias`, not `typing.Union` · Issue #137065 · python/cpython
Description: Bug report I think #105499 was a mistake. types.UnionType was intentionally named so to avoid confusion with typing.Union (see #88895). types.UnionType should not be subscriptable because it is not generic type (and if it was a generic t...
Open Graph Description: Bug report I think #105499 was a mistake. types.UnionType was intentionally named so to avoid confusion with typing.Union (see #88895). types.UnionType should not be subscriptable because it is not...
X Description: Bug report I think #105499 was a mistake. types.UnionType was intentionally named so to avoid confusion with typing.Union (see #88895). types.UnionType should not be subscriptable because it is not...
Opengraph URL: https://github.com/python/cpython/issues/137065
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Merge 'types.UnionType' with `typing._UnionGenericAlias`, not `typing.Union`","articleBody":"# Bug report\n\nI think #105499 was a mistake. `types.UnionType` was intentionally named so to avoid confusion with `typing.Union` (see #88895). `types.UnionType` should not be subscriptable because it is not generic type (and if it was a generic type, subscription would have different semantic than for `typing.Union`). `types.UnionType` corresponds to `typing._UnionGenericAlias`, not `typing.Union` (see https://github.com/python/cpython/issues/89581#issuecomment-1093932536).\n\nSo we should restore `typing.Union`, make `typing._UnionGenericAlias` an alias of `types.UnionType`, and make `types.UnionType` non-subscriptable again.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-137069\n* gh-138967\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/serhiy-storchaka","@type":"Person","name":"serhiy-storchaka"},"datePublished":"2025-07-24T05:20:20.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":19},"url":"https://github.com/137065/cpython/issues/137065"}
| 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:247ab7e5-5066-563f-f058-04378814e504 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D6EA:87739:1EBD1D9:2B28E29:696A5A11 |
| html-safe-nonce | 9ae199c11c4df0e9631459440e8ee8f8afa649cb537cccff5b771227bb23ba6f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkVBOjg3NzM5OjFFQkQxRDk6MkIyOEUyOTo2OTZBNUExMSIsInZpc2l0b3JfaWQiOiI4ODI0MjQ5Njg3MTA3ODUyODE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 857dfd2279bd19e1d4b94156fe213a6261519bc6f36d5b12adf02dadddec4fee |
| hovercard-subject-tag | issue:3258527900 |
| 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/137065/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b4208ecfdb3abc08a66712ade76eb73bceab7942a9c70e6ffab5da86cfc8b336/python/cpython/issues/137065 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b4208ecfdb3abc08a66712ade76eb73bceab7942a9c70e6ffab5da86cfc8b336/python/cpython/issues/137065 |
| og:image:alt | Bug report I think #105499 was a mistake. types.UnionType was intentionally named so to avoid confusion with typing.Union (see #88895). types.UnionType should not be subscriptable because it is not... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | serhiy-storchaka |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3f871c8e07f0ae1886fa8dac284166d28b09ad5bada6476fc10b674e489788ef |
| 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 | 63c426b30d262aba269ef14c40e3c817b384cd61 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width