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 daemon crash on malformed NamedTuple #14119

Merged
merged 3 commits into from
Nov 18, 2022

Conversation

ilevkivskyi
Copy link
Member

Fixes #14098

Having invalid statements in a NamedTuple is almost like a syntax error, we can remove them after giving an error (without further analysis). This PR does almost exactly the same as #13963 did for TypedDicts.

@github-actions

This comment has been minimized.

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, just left one idea about an additional thing to test.

class C: ...
x: int
y: int
# change
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe also test a change in another module to test AST stripping and reprocessing of an invalid named tuple?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it actually doesn't work. This btw also affects the recent TypedDict PR too, I am going to fix both.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@ilevkivskyi ilevkivskyi merged commit 1d6a5b1 into python:master Nov 18, 2022
@ilevkivskyi ilevkivskyi deleted the fix-daemon-nt-crash branch November 18, 2022 10:48
ChristianWitzler added a commit to ChristianWitzler/mypy that referenced this pull request Nov 21, 2022
Fix daemon crash on malformed NamedTuple (python#14119)
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.

Mypy Deamon crash on second run
3 participants