Skip to content

Fix daemon crash on malformed NamedTuple#14119

Merged
ilevkivskyi merged 3 commits into
python:masterfrom
ilevkivskyi:fix-daemon-nt-crash
Nov 18, 2022
Merged

Fix daemon crash on malformed NamedTuple#14119
ilevkivskyi merged 3 commits into
python:masterfrom
ilevkivskyi:fix-daemon-nt-crash

Conversation

@ilevkivskyi

Copy link
Copy Markdown
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.

@JukkaL JukkaL left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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
Copy Markdown
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.

Comment thread mypy/semanal_namedtuple.py Outdated
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
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