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

dataclasses.InitVar crashes on new analyzer #6955

Closed
ilevkivskyi opened this issue Jun 7, 2019 · 0 comments · Fixed by #6984
Closed

dataclasses.InitVar crashes on new analyzer #6955

ilevkivskyi opened this issue Jun 7, 2019 · 0 comments · Fixed by #6984
Assignees
Labels
crash priority-0-high semantic-analyzer Problems that happen during semantic analysis topic-plugins The plugin API and ideas for new plugins

Comments

@ilevkivskyi
Copy link
Member

Currently this test case crashes on the new semantic analyzer:

[case testDataclassesInitVars]
from dataclasses import InitVar, dataclass

defer: Yes

@dataclass
class Application:
  name: str
  database_name: InitVar[str]

class Yes: ...
[builtins fixtures/list.pyi]
@ilevkivskyi ilevkivskyi added crash priority-0-high topic-plugins The plugin API and ideas for new plugins semantic-analyzer Problems that happen during semantic analysis labels Jun 7, 2019
@JukkaL JukkaL self-assigned this Jun 11, 2019
JukkaL added a commit that referenced this issue Jun 13, 2019
Previously InitVar attributes were missing on the second semantic
analysis pass, since the dataclasses plugin removes those attributes
from the class symbol table. This caused a crash. The fix is to reset
the attribute declarations so that they will be re-added to the symbol
table on successive semantic analysis passes.

Fixes #6955.
JukkaL added a commit that referenced this issue Jun 13, 2019
Previously InitVar attributes were missing on the second semantic
analysis pass, since the dataclasses plugin removes those attributes
from the class symbol table. This caused a crash. The fix is to reset
the attribute declarations so that they will be re-added to the symbol
table on successive semantic analysis passes.

Fixes #6955.
PattenR pushed a commit to PattenR/mypy that referenced this issue Jun 23, 2019
…on#6984)

Previously InitVar attributes were missing on the second semantic
analysis pass, since the dataclasses plugin removes those attributes
from the class symbol table. This caused a crash. The fix is to reset
the attribute declarations so that they will be re-added to the symbol
table on successive semantic analysis passes.

Fixes python#6955.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash priority-0-high semantic-analyzer Problems that happen during semantic analysis topic-plugins The plugin API and ideas for new plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants