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

[stubtest] Respect @final runtime decorator, enforce it in stubs #14922

Merged
merged 2 commits into from
Mar 19, 2023

Conversation

sobolevn
Copy link
Member

Closes #14921

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Nice idea! Should we do the same for @typing(_extensions).override?

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Also:

  • Methods can also be decorated with @final/@override, maybe we should also verify those in the same way?
  • We should add a comment next to this line, saying that we give a specialised error for classes decorated with @final elsewhere:
    "__final__",

mypy/stubtest.py Outdated Show resolved Hide resolved
@sobolevn
Copy link
Member Author

sobolevn commented Mar 19, 2023

@AlexWaygood I don't see much value in @override decorator support, but I guess it is kinda easy to add. So, why not?

I will also work on @final decorator support on methods in the next PR. Nice idea!

Thanks a lot for the review, I am going to merge this when the CI is green 👍

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.

Source code that has @final decorator does not require @final in stub
3 participants