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 when nested class appears in a protocol #13489

Merged
merged 1 commit into from
Aug 24, 2022

Conversation

ilevkivskyi
Copy link
Member

Fixes #6393

This is unspecified behavior in terms of PEP 544, so we just try to do something meaningful (see test case). At least we should not crash.

@ilevkivskyi
Copy link
Member Author

Just to be clear, we can also simply give an error and exclude nested classes from protocol members. But it will be actually more lines of code than giving some reasonable support.

@github-actions
Copy link
Contributor

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

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.

This looks reasonable.

@JukkaL JukkaL merged commit 61a9b92 into python:master Aug 24, 2022
@ilevkivskyi ilevkivskyi deleted the fix-proto-crash branch August 24, 2022 09:58
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.

Nested class in Protocol causes mypy exception
2 participants