{"action":"created","issue":{"url":"https://api.github.com/repos/python/mypy/issues/4016","repository_url":"https://api.github.com/repos/python/mypy","labels_url":"https://api.github.com/repos/python/mypy/issues/4016/labels{/name}","comments_url":"https://api.github.com/repos/python/mypy/issues/4016/comments","events_url":"https://api.github.com/repos/python/mypy/issues/4016/events","html_url":"https://github.com/python/mypy/pull/4016","id":260746552,"number":4016,"title":"Fix checking of self when accessing a non-method callable attribute (take 2)","user":{"login":"elazarg","id":5108069,"avatar_url":"https://avatars2.githubusercontent.com/u/5108069?v=4","gravatar_id":"","url":"https://api.github.com/users/elazarg","html_url":"https://github.com/elazarg","followers_url":"https://api.github.com/users/elazarg/followers","following_url":"https://api.github.com/users/elazarg/following{/other_user}","gists_url":"https://api.github.com/users/elazarg/gists{/gist_id}","starred_url":"https://api.github.com/users/elazarg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elazarg/subscriptions","organizations_url":"https://api.github.com/users/elazarg/orgs","repos_url":"https://api.github.com/users/elazarg/repos","events_url":"https://api.github.com/users/elazarg/events{/privacy}","received_events_url":"https://api.github.com/users/elazarg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-26T19:45:52Z","updated_at":"2017-09-29T15:54:24Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/python/mypy/pulls/4016","html_url":"https://github.com/python/mypy/pull/4016","diff_url":"https://github.com/python/mypy/pull/4016.diff","patch_url":"https://github.com/python/mypy/pull/4016.patch"},"body":"Fix #3223. Minimal examples:\r\n```python\r\nfrom typing import Callable\r\nclass X:\r\n    f: Callable[[object], None]\r\nX().f  # E: Invalid method type\r\n```\r\n```python\r\nclass X:\r\n    @property\r\n    def g(self: object): pass\r\nX().g  # E: Invalid method type\r\n```\r\nThe problem is that for non-methods the check performed on access to `self` is whether `object <: X` instead of the other way around.\r\n\r\n1. Reverse subtyping check. This change alone fixes the issue described above.\r\n2. For classmethod, fallback on the argument instead of on the parameter\r\n3. Mimic dispatch better: meet `original_type` with static class. This handles the case were instead of `X()` above there was something of type `Union[X, Y]`.\r\n4. Better error message\r\n\r\nTake 2 of #3227, but without the reverse-operator part"},"comment":{"url":"https://api.github.com/repos/python/mypy/issues/comments/333165378","html_url":"https://github.com/python/mypy/pull/4016#issuecomment-333165378","issue_url":"https://api.github.com/repos/python/mypy/issues/4016","id":333165378,"user":{"login":"gvanrossum","id":2894642,"avatar_url":"https://avatars3.githubusercontent.com/u/2894642?v=4","gravatar_id":"","url":"https://api.github.com/users/gvanrossum","html_url":"https://github.com/gvanrossum","followers_url":"https://api.github.com/users/gvanrossum/followers","following_url":"https://api.github.com/users/gvanrossum/following{/other_user}","gists_url":"https://api.github.com/users/gvanrossum/gists{/gist_id}","starred_url":"https://api.github.com/users/gvanrossum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvanrossum/subscriptions","organizations_url":"https://api.github.com/users/gvanrossum/orgs","repos_url":"https://api.github.com/users/gvanrossum/repos","events_url":"https://api.github.com/users/gvanrossum/events{/privacy}","received_events_url":"https://api.github.com/users/gvanrossum/received_events","type":"User","site_admin":false},"created_at":"2017-09-29T15:54:24Z","updated_at":"2017-09-29T15:54:24Z","author_association":"OWNER","body":"Sorry, this is too late to make it into the 0.530 release. It's a minor issue and it touches subtle parts of the codebase. Let's postpone it."}}
{"actor":{"display_login":"gvanrossum"}}