Repository navigation
Add error when making abstractmethod final - #12743
Merged
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
| if dec.decorators and dec.var.is_property: | ||
| self.fail('Decorated property not supported', dec) | ||
| if dec.func.is_abstract and dec.func.is_final: | ||
| self.fail(f"Final method {dec.func.name} has abstract attributes", dec) |
Member
There was a problem hiding this comment.
This error message doesn't work very well here. Suggested change:
Suggested change
| self.fail(f"Final method {dec.func.name} has abstract attributes", dec) | |
| self.fail(f"Method {dec.func.name} is both abstract and final", dec) |
Contributor
Author
There was a problem hiding this comment.
@JelleZijlstra
Thank you for your review!
I'll change the error message!
JelleZijlstra
approved these changes
May 8, 2022
Contributor
|
According to mypy_primer, this change has no effect on the checked open source code. π€π |
Member
|
Congrats on your first contribution, @nakatomotoi! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This fixes #12164.
When an abstract method is tried to make as
final, an error will be raised.Test Plan
Added a simple test case to make sure mypy doesn't raise an exception.