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 crash in dataclass protocol with self attribute assignment #15157

Merged
merged 2 commits into from
May 2, 2023

Conversation

ilevkivskyi
Copy link
Member

Fix #15004

FWIW I don't think dataclass protocols make much sense, but we definitely should not crash. Also the root cause has nothing to do with dataclasses, the problem is that a self attribute assignment in a protocol created a new Var (after an original Var was created in class body), which is obviously wrong.

@ilevkivskyi ilevkivskyi requested a review from JukkaL April 29, 2023 19:20
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

spark (https://github.com/apache/spark) got 1.05x faster (101.6s -> 96.5s)

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.

LGTM

@JukkaL JukkaL merged commit b5107a9 into python:master May 2, 2023
@ilevkivskyi ilevkivskyi deleted the fix-proto-dataclass-crash branch May 2, 2023 15:59
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.

AssertionError: Internal error: too many class plugin hook passes
2 participants