typing icon indicating copy to clipboard operation
typing copied to clipboard

Add conformance test for `@final` combined with `@property`

Open samwgoldman opened this issue 10 months ago • 4 comments

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.

samwgoldman avatar Jan 31 '25 05:01 samwgoldman

All commit authors signed the Contributor License Agreement.
CLA signed

ghost avatar Jan 31 '25 05:01 ghost

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.

erictraut avatar Jan 31 '25 05:01 erictraut

Thanks for the guidance!

samwgoldman avatar Jan 31 '25 06:01 samwgoldman

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 :-)

hauntsaninja avatar Jan 31 '25 08:01 hauntsaninja