Title: `typing._UnionGenericAlias` is unhashable in 3.14 · Issue #133925 · python/cpython · GitHub
Open Graph Title: `typing._UnionGenericAlias` is unhashable in 3.14 · Issue #133925 · python/cpython
X Title: `typing._UnionGenericAlias` is unhashable in 3.14 · Issue #133925 · python/cpython
Description: Bug report Bug description: typing._UnionGenericAlias) became unshable somewhere between 3.13 and 3.14.0b1 (most likely in gh-105511) import typing hash(typing._UnionGenericAlias) Traceback (most recent call last): File "
Open Graph Description: Bug report Bug description: typing._UnionGenericAlias) became unshable somewhere between 3.13 and 3.14.0b1 (most likely in gh-105511) import typing hash(typing._UnionGenericAlias) Traceback (most r...
X Description: Bug report Bug description: typing._UnionGenericAlias) became unshable somewhere between 3.13 and 3.14.0b1 (most likely in gh-105511) import typing hash(typing._UnionGenericAlias) Traceback (most r...
Opengraph URL: https://github.com/python/cpython/issues/133925
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`typing._UnionGenericAlias` is unhashable in 3.14","articleBody":"# Bug report\n\n### Bug description:\n\n`typing._UnionGenericAlias)` became unshable somewhere between 3.13 and 3.14.0b1 (most likely in gh-105511)\n\n```py\nimport typing\nhash(typing._UnionGenericAlias)\n```\n```python-traceback\nTraceback (most recent call last):\n File \"\u003cpython-input-0\u003e\", line 2, in \u003cmodule\u003e\n hash(typing._UnionGenericAlias)\n ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^\nTypeError: unhashable type: '_UnionGenericAliasMeta'\n```\n\nThis was hit in a doctest from `astropy`: xref https://github.com/astropy/astropy/issues/18126\nTo be clear, the test in question doesn't necessarily correspond to a real-life application; we're testing that our `itersubclasses` utility function works in a very broad case where we try to retrieve all defined subclasses of `object`, and do a bit of internal book-keeping using a `set` of already-visited classes. This used to work in Python 3.13 (and seems to have worked with no interruption for 10+ years), so it still seemed worth a shot to see if that would be considered a bug here. Otherwise, it should be possible to fix the function on our side to either special case this exact class, ignore any unhashable class, or avoid reequiring hashability altogether. \n\n\n### CPython versions tested on:\n\n3.14\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-133929\n* gh-133936\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/neutrinoceros","@type":"Person","name":"neutrinoceros"},"datePublished":"2025-05-12T13:32:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/133925/cpython/issues/133925"}
| 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:8e92acca-a396-b1da-1b0b-f883b96bd6ce |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA1E:323DD4:C38633:10F5C4D:696A8C11 |
| html-safe-nonce | 24c9479812c6f6a4e93b836dcf6f414c370d543edc8829682e4adf48ba64c84d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTFFOjMyM0RENDpDMzg2MzM6MTBGNUM0RDo2OTZBOEMxMSIsInZpc2l0b3JfaWQiOiIyMTU0MTk0NTQwNDYzNTU3NjQ5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9784b32bbab8811e28c985f3597b96dc519aa18a1b22066e0bc3b1c8b220ae1e |
| hovercard-subject-tag | issue:3056995668 |
| 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/133925/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2c0e525310bf44ad3b1ada63171e212872b0d792471d85a98615306287dcd13b/python/cpython/issues/133925 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2c0e525310bf44ad3b1ada63171e212872b0d792471d85a98615306287dcd13b/python/cpython/issues/133925 |
| og:image:alt | Bug report Bug description: typing._UnionGenericAlias) became unshable somewhere between 3.13 and 3.14.0b1 (most likely in gh-105511) import typing hash(typing._UnionGenericAlias) Traceback (most r... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | neutrinoceros |
| hostname | github.com |
| expected-hostname | github.com |
| None | d2aa6dedd7d97fa651b17c40401f2605f309df5ca5fb659bf0554cf34f1de825 |
| 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 | c1dbca8981c5e3d6a69bce2f1d289e732b86241d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width