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

Added [prop-decorator] code for unsupported property decorators (#14461) #16571

Conversation

analog-cbarber
Copy link
Contributor

Using a decorator before a @Property now results in the narrower prop-decorator code, which is a subcode of misc for backward compatibility.

I would have preferred to add a more general Unsupported error code and have this be a subcode of that, but this has to be a subcode of misc for backward compatibility.

Fixes #14461

analog-cbarber and others added 2 commits November 26, 2023 11:33
…on#14461)

Using a decorator before a @Property now results in
the narrower `prop-decorator` code, which is a subcode
of `misc` for backward compatibility.

This comment has been minimized.

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Sorry, I wrote this a while ago but never submitted a review.

@@ -1241,6 +1241,10 @@ class A:
@property # OK
@dec
def g(self) -> int: pass
@dec # type: ignore[misc]
def h(self) -> int: pass
@dec # type: ignore[prop-decorator]
Copy link
Member

Choose a reason for hiding this comment

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

Unused ignores aren't caught here. You're missing @property.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

doh!

This comment has been minimized.

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/series.py:798: error: Unused "type: ignore" comment, use narrower [prop-decorator] instead of [misc] code  [unused-ignore]

@JelleZijlstra JelleZijlstra merged commit dfab362 into python:master May 18, 2024
19 checks passed
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.

Decorators on top of @property are not supported
3 participants