Title: match-case class checking against `collection.abc.Callable` raises error [misc] · Issue #14014 · python/mypy · GitHub
Open Graph Title: match-case class checking against `collection.abc.Callable` raises error [misc] · Issue #14014 · python/mypy
X Title: match-case class checking against `collection.abc.Callable` raises error [misc] · Issue #14014 · python/mypy
Description: Bug Report trying to match-case by class collections.abc.Callable raises error: Expected type in class pattern; found "typing._SpecialForm" [misc] To Reproduce https://mypy-play.net/?mypy=master&python=3.10&gist=29d49c837fadc7e404ea295c8...
Open Graph Description: Bug Report trying to match-case by class collections.abc.Callable raises error: Expected type in class pattern; found "typing._SpecialForm" [misc] To Reproduce https://mypy-play.net/?mypy=master&py...
X Description: Bug Report trying to match-case by class collections.abc.Callable raises error: Expected type in class pattern; found "typing._SpecialForm" [misc] To Reproduce https://mypy-play.net/?mypy...
Opengraph URL: https://github.com/python/mypy/issues/14014
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"match-case class checking against `collection.abc.Callable` raises error [misc]","articleBody":"\u003c!--\r\nIf you're not sure whether what you're experiencing is a mypy bug, please see the \"Question and Help\" form instead.\r\nPlease consider:\r\n\r\n- checking our common issues page: https://mypy.readthedocs.io/en/stable/common_issues.html\r\n- searching our issue tracker: https://github.com/python/mypy/issues to see if it's already been reported\r\n- asking on gitter chat: https://gitter.im/python/typing\r\n-->\r\n\r\n**Bug Report**\r\n\r\ntrying to match-case by class `collections.abc.Callable` raises\r\n\r\n`error: Expected type in class pattern; found \"typing._SpecialForm\" [misc]`\r\n\r\n**To Reproduce**\r\n\r\nhttps://mypy-play.net/?mypy=master&python=3.10&gist=29d49c837fadc7e404ea295c82d0d28a\r\n\r\n```python\r\nfrom collections.abc import *\r\n\r\nx = {1:1}\r\n\r\nmatch x:\r\n case Mapping():\r\n print(\"Mapping\")\r\n case Sequence():\r\n print(\"Sequence\")\r\n case Callable(): # ✘ error: Expected type in class pattern [misc]\r\n print(\"Callable\")\r\n```\r\n\r\n**Expected Behavior**\r\n\r\nGiven that `collection.abc` classes are `isinstance`-checkable, and it works with the others it should work here as well.\r\n\r\n**Your Environment**\r\n\r\nTested with 0.981, 0.982 and master branch\r\n\r\nhttps://mypy-play.net/?mypy=master&python=3.10&gist=29d49c837fadc7e404ea295c82d0d28a","author":{"url":"https://github.com/randolf-scholz","@type":"Person","name":"randolf-scholz"},"datePublished":"2022-11-05T21:16:59Z","url":"https://github.com/python/mypy/issues/14014"}
| 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:5e2beb46-3d53-1f3c-3da4-1716dac04060 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BFEA:2FF516:DECC43:12BBF4F:6B0054DC |
| html-safe-nonce | 60cc88d802a07f2e1b42cb034357ebfcab236e92190bc325ffb160327b46ff51 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkVBOjJGRjUxNjpERUNDNDM6MTJCQkY0Rjo2QjAwNTREQyIsInZpc2l0b3JfaWQiOiI1Mjc4OTA1MDE0OTQ3OTYwMDI4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3e6e5075a5490596e0357b9e80759f65b7a842251bc0fb7af0c9b206158d4a12 |
| hovercard-subject-tag | issue:1437189663 |
| 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/mypy/14014/issue_layout |
| twitter:image | https://opengraph.githubassets.com/57f109d008687e7ebfb53cc3519921823e2bf9faf244c0fbace6dd9167f2d2db/python/mypy/issues/14014 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/57f109d008687e7ebfb53cc3519921823e2bf9faf244c0fbace6dd9167f2d2db/python/mypy/issues/14014 |
| og:image:alt | Bug Report trying to match-case by class collections.abc.Callable raises error: Expected type in class pattern; found "typing._SpecialForm" [misc] To Reproduce https://mypy-play.net/?mypy=master&py... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | randolf-scholz |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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