Title: Types are not hashable (for lru_cache) · Issue #4638 · python/typeshed · GitHub
Open Graph Title: Types are not hashable (for lru_cache) · Issue #4638 · python/typeshed
X Title: Types are not hashable (for lru_cache) · Issue #4638 · python/typeshed
Description: $ cat tmp/typesort.py from typing import Type from functools import lru_cache class A: pass @lru_cache() def f(x: Type[A]) -> None: pass x: Type[A] f(x) $ mypy tmp/typesort.py tmp/typesort.py:15: error: Argument 1 to "__call__" of "_lru_...
Open Graph Description: $ cat tmp/typesort.py from typing import Type from functools import lru_cache class A: pass @lru_cache() def f(x: Type[A]) -> None: pass x: Type[A] f(x) $ mypy tmp/typesort.py tmp/typesort.py:15: e...
X Description: $ cat tmp/typesort.py from typing import Type from functools import lru_cache class A: pass @lru_cache() def f(x: Type[A]) -> None: pass x: Type[A] f(x) $ mypy tmp/typesort.py tmp/typesort.py:15...
Opengraph URL: https://github.com/python/typeshed/issues/4638
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Types are not hashable (for lru_cache)","articleBody":"```\r\n$ cat tmp/typesort.py \r\nfrom typing import Type\r\nfrom functools import lru_cache\r\n\r\n\r\nclass A:\r\n pass\r\n\r\n\r\n@lru_cache()\r\ndef f(x: Type[A]) -> None:\r\n pass\r\n\r\n\r\nx: Type[A]\r\nf(x)\r\n$ mypy tmp/typesort.py \r\ntmp/typesort.py:15: error: Argument 1 to \"__call__\" of \"_lru_cache_wrapper\" has incompatible type \"Type[A]\"; expected \"Hashable\"\r\nFound 1 error in 1 file (checked 1 source file)\r\n```\r\n\r\nThis is a regression in mypy 0.790, but I haven't figured out whether it's due to changes in typeshed or mypy. I'm hoping it's fixable in typeshed. Interestingly mypy allows `{x}` (a set with `x` in it).","author":{"url":"https://github.com/JelleZijlstra","@type":"Person","name":"JelleZijlstra"},"datePublished":"2020-10-09T18:47:50Z","url":"https://github.com/python/typeshed/issues/4638"}
| 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:06d29d90-b616-bdcb-d0cb-8a4f2a002f39 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA20:F5AA9:1FC3B08:2B22A74:6B001A23 |
| html-safe-nonce | 790626d594b01861f8a1b2720d49b725ed378355a72375e03d4520f59796689a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTIwOkY1QUE5OjFGQzNCMDg6MkIyMkE3NDo2QjAwMUEyMyIsInZpc2l0b3JfaWQiOiI3MDY2MzIzNDY4NDE2OTgxNTM5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d9df83cbb6a902fe8d68f166f7c27e2a85d8827bada0f96f7740bd771fad3397 |
| hovercard-subject-tag | issue:718353589 |
| 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/typeshed/4638/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5a6e05ef4f0587f54ebf6b3bccd0b8349559a8c8ce0673310700772435dd99c0/python/typeshed/issues/4638 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5a6e05ef4f0587f54ebf6b3bccd0b8349559a8c8ce0673310700772435dd99c0/python/typeshed/issues/4638 |
| og:image:alt | $ cat tmp/typesort.py from typing import Type from functools import lru_cache class A: pass @lru_cache() def f(x: Type[A]) -> None: pass x: Type[A] f(x) $ mypy tmp/typesort.py tmp/typesort.py:15: e... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JelleZijlstra |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width