Title: `type[...]` objects don't support `__qualname__` · Issue #19060 · python/mypy · GitHub
Open Graph Title: `type[...]` objects don't support `__qualname__` · Issue #19060 · python/mypy
X Title: `type[...]` objects don't support `__qualname__` · Issue #19060 · python/mypy
Description: Bug Report, To Reproduce, & Actual Behaviour This came about while writing a simple function to extract objects' fully-qualified names. See mypy Playground: from typing import Protocol, Any class SupportsQualname(Protocol): __qualname__:...
Open Graph Description: Bug Report, To Reproduce, & Actual Behaviour This came about while writing a simple function to extract objects' fully-qualified names. See mypy Playground: from typing import Protocol, Any class S...
X Description: Bug Report, To Reproduce, & Actual Behaviour This came about while writing a simple function to extract objects' fully-qualified names. See mypy Playground: from typing import Protocol, Any...
Opengraph URL: https://github.com/python/mypy/issues/19060
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`type[...]` objects don't support `__qualname__`","articleBody":"**Bug Report, To Reproduce, & Actual Behaviour**\n\nThis came about while writing a simple function to extract objects' fully-qualified names. See [mypy Playground](https://mypy-play.net/?mypy=master&python=3.13&gist=5d6cb906c0b3e2d6d696583a5a319962):\n\n```python\nfrom typing import Protocol, Any\n\nclass SupportsQualname(Protocol):\n __qualname__: str\n\ndef f(C: SupportsQualname, /) -> str:\n return C.__qualname__\n\nClass0: type = int\nClass1: type[int] = int\nClass2: type[Any] = int\nClass3: type[object] = int\nf(Class0) # OK\nf(Class1) # E: Argument 1 to \"f\" has incompatible type \"type[int]\"; expected \"SupportsQualname\" [arg-type]\nf(Class2) # E: Argument 1 to \"f\" has incompatible type \"type[Any]\"; expected \"SupportsQualname\" [arg-type]\nf(Class3) # E: Argument 1 to \"f\" has incompatible type \"type[object]\"; expected \"SupportsQualname\" [arg-type]\n```\n\n**Expected Behavior**\n\nNo errors\n\n**Your Environment**\n\n- Mypy version used: 1.15, master\n- Mypy command-line flags: None\n- Mypy configuration options from `mypy.ini` (and other config files): None\n- Python version used: 3.12, 3.13\n","author":{"url":"https://github.com/bzoracler","@type":"Person","name":"bzoracler"},"datePublished":"2025-05-09T03:59:54Z","url":"https://github.com/python/mypy/issues/19060"}
| 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:5c8ebb8a-0d99-81c2-f784-5bc6b4c85b4c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A4F4:43251:17BC023:1F9577D:6B002D07 |
| html-safe-nonce | 9eb2262ed220167063807c90968996e6141e761db5becaf4bdac9b1163570de1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNEY0OjQzMjUxOjE3QkMwMjM6MUY5NTc3RDo2QjAwMkQwNyIsInZpc2l0b3JfaWQiOiIzOTUxMjQ3NDUxNzEyNjYyNzkxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c4bd5bc45eac2d88c84d41d73092cc269a56ec2d04990cac115cf6ee1d0f7c8c |
| hovercard-subject-tag | issue:3050676064 |
| 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/19060/issue_layout |
| twitter:image | https://opengraph.githubassets.com/03e5e76fd7acec95c16011d662ca804e27cdb87bc18ee1c20163b883b7dbe81b/python/mypy/issues/19060 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/03e5e76fd7acec95c16011d662ca804e27cdb87bc18ee1c20163b883b7dbe81b/python/mypy/issues/19060 |
| og:image:alt | Bug Report, To Reproduce, & Actual Behaviour This came about while writing a simple function to extract objects' fully-qualified names. See mypy Playground: from typing import Protocol, Any class S... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bzoracler |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width