{"action":"closed","issue":{"url":"https://api.github.com/repos/python/mypy/issues/1720","repository_url":"https://api.github.com/repos/python/mypy","labels_url":"https://api.github.com/repos/python/mypy/issues/1720/labels{/name}","comments_url":"https://api.github.com/repos/python/mypy/issues/1720/comments","events_url":"https://api.github.com/repos/python/mypy/issues/1720/events","html_url":"https://github.com/python/mypy/issues/1720","id":161007424,"number":1720,"title":"type of Union containing Any is incorrectly inferred after an isinstance check","user":{"login":"sharmaeklavya2","id":3839472,"avatar_url":"https://avatars.githubusercontent.com/u/3839472?v=3","gravatar_id":"","url":"https://api.github.com/users/sharmaeklavya2","html_url":"https://github.com/sharmaeklavya2","followers_url":"https://api.github.com/users/sharmaeklavya2/followers","following_url":"https://api.github.com/users/sharmaeklavya2/following{/other_user}","gists_url":"https://api.github.com/users/sharmaeklavya2/gists{/gist_id}","starred_url":"https://api.github.com/users/sharmaeklavya2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharmaeklavya2/subscriptions","organizations_url":"https://api.github.com/users/sharmaeklavya2/orgs","repos_url":"https://api.github.com/users/sharmaeklavya2/repos","events_url":"https://api.github.com/users/sharmaeklavya2/events{/privacy}","received_events_url":"https://api.github.com/users/sharmaeklavya2/received_events","type":"User","site_admin":false},"labels":[{"id":21488356,"url":"https://api.github.com/repos/python/mypy/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/python/mypy/milestones/5","html_url":"https://github.com/python/mypy/milestones/0.4.x","labels_url":"https://api.github.com/repos/python/mypy/milestones/5/labels","id":1616634,"number":5,"title":"0.4.x","description":"The next release, and the next, within 0.4.x.\r\n\r\n(This is not strictly a milestone, just issues we'd like to get to before 0.5.0. For now we're going to a 6-week release cadence. So since 0.4.3 went out on July 14 and 0.4.4 went out on August 25, 0.4.5 should go out on October 6, 2016.)","creator":{"login":"ddfisher","id":245905,"avatar_url":"https://avatars.githubusercontent.com/u/245905?v=3","gravatar_id":"","url":"https://api.github.com/users/ddfisher","html_url":"https://github.com/ddfisher","followers_url":"https://api.github.com/users/ddfisher/followers","following_url":"https://api.github.com/users/ddfisher/following{/other_user}","gists_url":"https://api.github.com/users/ddfisher/gists{/gist_id}","starred_url":"https://api.github.com/users/ddfisher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddfisher/subscriptions","organizations_url":"https://api.github.com/users/ddfisher/orgs","repos_url":"https://api.github.com/users/ddfisher/repos","events_url":"https://api.github.com/users/ddfisher/events{/privacy}","received_events_url":"https://api.github.com/users/ddfisher/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":83,"state":"open","created_at":"2016-03-01T23:19:26Z","updated_at":"2016-11-15T18:35:28Z","due_on":"2016-11-18T00:00:00Z","closed_at":null},"comments":3,"created_at":"2016-06-18T05:09:50Z","updated_at":"2016-11-15T18:35:28Z","closed_at":"2016-11-15T18:35:28Z","body":"`union_any.py`:\n\n``` py\nfrom typing import Any, Union\n\ndef func(v):\n    # type: (Union[int, Any]) -> str\n    if isinstance(v, int):\n        s = hex(v)\n    else:\n        s = str(v).lower()\n    return \"key:\" + s\n```\n\n`mypy union_any.py`:\n\n```\nunion_any.py: note: In function \"func\":\nunion_any.py:8: error: No overload variant of \"str\" matches argument types [Union[<ERROR>, void]]\n```\n\n`mypy --py2 union_any.py`:\n\n```\nunion_any.py: note: In function \"func\":\nunion_any.py:8: error: Argument 1 to \"str\" has incompatible type \"Union[object, None]\"; expected \"object\"\n```\n\nI discovered this when I used a class which was defined in some library which did not have stubs and I was using `--silent-imports`.\n"}}
{"actor":{"display_login":"JukkaL"}}