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

Never put None in TupleType items #4051

Merged
merged 3 commits into from Oct 3, 2017

Conversation

ilevkivskyi
Copy link
Member

Fixes #4046

The root cause for the crash is that None was put in TupleType items if the corresponding lvalue is a definition. Then the crash happens when this TupleType is used as a context for rvalue type inference. The solution is to put UninhabitedType in such cases, so that inference will fall back on using argument types instead.

This PR should not cause any crashes but it makes sense to test it against internal codebases since it touches an area that might alter type inference in corner cases.

Copy link
Collaborator

@ethanhs ethanhs left a comment

Choose a reason for hiding this comment

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

Fix looks good to me as long as it works for @ambv / @carljm.

@gvanrossum gvanrossum merged commit d23fc47 into python:master Oct 3, 2017
@gvanrossum
Copy link
Member

I checked our internal codebase and everything's fine. Thanks for the quick fix! I'll ponder it a little bit and then probably cherry-pick.

@gvanrossum gvanrossum mentioned this pull request Oct 3, 2017
5 tasks
@carljm
Copy link
Member

carljm commented Oct 3, 2017

This fixes the issue for us as well. Thanks @ilevkivskyi!

@ilevkivskyi ilevkivskyi deleted the fix-nested-tuples branch October 20, 2017 23:06
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.

None yet

4 participants