Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widen type to Any when isinstance(..., Any) is True #3751

Merged
merged 3 commits into from
Nov 22, 2017

Conversation

miedzinski
Copy link
Contributor

Fixes #3474.

@@ -1770,3 +1770,13 @@ def narrow_any_to_str_then_reassign_to_int() -> None:
reveal_type(v) # E: Revealed type is 'Any'

[builtins fixtures/isinstance.pyi]

[case testIsinstanceWidensWithAnyArg]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good fix, but could you please add few more tests:

  • With an error and # type: ignore
  • With an "un-imported" Any
  • With an initial type that is not a union

@ilevkivskyi
Copy link
Member

This appeared again, are you still working on this PR?

@JukkaL
Copy link
Collaborator

JukkaL commented Nov 15, 2017

@miedzinski Are you interested in finishing this PR?

@miedzinski
Copy link
Contributor Author

@JukkaL Yes, I am. I have merged master into my branch and will look into this weekend.

@miedzinski
Copy link
Contributor Author

@ilevkivskyi Do you have any ideas for more test cases?

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@ilevkivskyi ilevkivskyi merged commit 0bbf714 into python:master Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants