typing
typing copied to clipboard
Add conformance test for `@final` combined with `@property`
The language of the typing spec indicates that the @final decorator may be used with properties:
The method decorator version may be used with all of instance methods, class methods, static methods, and properties.
I noticed this case while working on Pyre. I observed that Mypy and Pyright also differ in behavior, so it seemed like a good conformance test to add.
See discussion here: https://discuss.python.org/t/proposal-allow-chaining-final-decorator-when-previous-decorators-return-a-non-function/78918
I also added an example to the spec itself. I think it's a practical example, but also happy to remove it as well, since the existing content makes it pretty clear that the example should be allowed.
Thanks for reporting this and adding the conformance test. FYI, I've filed the following bug in the pyright issue tracker: https://github.com/microsoft/pyright/issues/9795.
Thanks for the guidance!
I guess always a risk changing a pyright conformant value, because odds are 50/50 that Eric will have fixed it before the PR is merged :-)