Title: Callable type is reported as not callable when used as a decorator · Issue #11639 · python/mypy · GitHub
Open Graph Title: Callable type is reported as not callable when used as a decorator · Issue #11639 · python/mypy
X Title: Callable type is reported as not callable when used as a decorator · Issue #11639 · python/mypy
Description: Example: from typing import Callable, Union, Any, overload, Protocol class DCall(Protocol): def __call__(self, arg: Union[int, str]) -> None: ... class D: def __getattr__(self, attr: str) -> DCall: # This method might contain something l...
Open Graph Description: Example: from typing import Callable, Union, Any, overload, Protocol class DCall(Protocol): def __call__(self, arg: Union[int, str]) -> None: ... class D: def __getattr__(self, attr: str) -> DCall:...
X Description: Example: from typing import Callable, Union, Any, overload, Protocol class DCall(Protocol): def __call__(self, arg: Union[int, str]) -> None: ... class D: def __getattr__(self, attr: str) -> ...
Opengraph URL: https://github.com/python/mypy/issues/11639
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Callable type is reported as not callable when used as a decorator","articleBody":"Example:\r\n\r\n```python\r\nfrom typing import Callable, Union, Any, overload, Protocol\r\n\r\nclass DCall(Protocol):\r\n def __call__(self, arg: Union[int, str]) -> None:\r\n ...\r\n\r\nclass D:\r\n def __getattr__(self, attr: str) -> DCall:\r\n # This method might contain something like during runtime:\r\n # if attr == '__call__':\r\n # return some_func\r\n # assert False\r\n ...\r\n\r\ndef dec_d(f: Callable[..., Any]) -> D:\r\n return D()\r\n\r\n@overload\r\ndef f_d(arg: int) -> None: ...\r\n@overload\r\ndef f_d(arg: str) -> None: ...\r\n@dec_d\r\ndef f_d(arg: Union[int, str]) -> None: ...\r\n\r\n```\r\n\r\nOutputs:\r\n\r\n```\r\nout/ex.py:18: error: \"D\" not callable\r\n```\r\n\r\nThis happens here: \r\n\r\nhttps://github.com/python/mypy/blob/4f59ca490072a45dce5839e6397791d79dcf3352/mypy/checker.py#L510-L520\r\n\r\nRefs https://github.com/python/mypy/pull/11638\r\nRefs https://github.com/python/mypy/pull/11630","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2021-11-29T10:13:52Z","url":"https://github.com/python/mypy/issues/11639"}
| 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:09b0812d-e25c-96a7-e1bd-03de66f23850 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E00:3CBF1A:203A525:2C2032D:6B0027E6 |
| html-safe-nonce | 912d2c07b6c1086aa76e6b3b0bd591b7289b16e4e295fa6cc81e61ec9947661d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTAwOjNDQkYxQToyMDNBNTI1OjJDMjAzMkQ6NkIwMDI3RTYiLCJ2aXNpdG9yX2lkIjoiNjE0NjA4NTI4NzQwNDUxMzI1NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3b0c9139091d99bbaf81392bf39ee0ee39b39d306065a257133ddfc42ab01c51 |
| hovercard-subject-tag | issue:1065851743 |
| 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/11639/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8d327b06df6958262b02d417ec02535257cb12269cb1551ce1a72b4889614902/python/mypy/issues/11639 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8d327b06df6958262b02d417ec02535257cb12269cb1551ce1a72b4889614902/python/mypy/issues/11639 |
| og:image:alt | Example: from typing import Callable, Union, Any, overload, Protocol class DCall(Protocol): def __call__(self, arg: Union[int, str]) -> None: ... class D: def __getattr__(self, attr: str) -> DCall:... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width