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

Fix new semantic analyser crash on unpacking to star lvalue and enable sample tests #7127

Merged
merged 3 commits into from
Jul 2, 2019

Conversation

ilevkivskyi
Copy link
Member

Fixes #7117

As explained in the issue this didn't crash with old analyser because it was compensated by another bug: Var.is_ready was set to True in some conditions thus silently inferring an Any type instead of deferring the node, see added test.

The actual crash was caused by the fact that star lvalue was previously checked as a generic reference expression, instead of processing it as name definition, thus triggering a bogus unexpected deferral.

@ilevkivskyi ilevkivskyi requested a review from JukkaL July 2, 2019 12:56
@ilevkivskyi
Copy link
Member Author

Just to clarify, this is not the same as #7126. Even with the regression fixed, #7117 would still produce bogus Cannot determine type of '...' on unpacking to star lvalues that are definitions.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Looks good. I'm glad that we'll now be able to tests samples using the new semantic analyzer.

@ilevkivskyi ilevkivskyi merged commit 6ec3f48 into python:master Jul 2, 2019
@ilevkivskyi ilevkivskyi deleted the newan-fix-samples-crash branch July 2, 2019 15:43
hauntsaninja pushed a commit that referenced this pull request Feb 8, 2023
Fixes #14250

This one is interesting. It looks like most likely this was caused by my
PR #7127 that fixed other crash.
After looking a bit more, `StarType` is something old, and should never
by used. At least I didn't find `visit_star_type()` in any of the type
visitors. Actually mypy already uses `assert False`, if we get to a
non-special-cased star expression.

Btw, I noticed that `pythoneval` test with empty expected output passes
in case of a crash (at least on my machine), so I fix this too.
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.

SamplesSuite.test_samples crashes on new semantic analyzer
2 participants