-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
false negative for protected-access in pylint 2.4.0 (new from 2.3.1) #3120
Comments
@jazelenk thanks for the report.
the when we run pylint against it we got :
As it seems there is no issue here, i close this issue. If i'm wrong or if those explanations are not clear feel free to reopen it. |
I agree that you are describing the current behavior, which is new in 2.4.0. That was not the behavior in older versions. I understand the goal, but this happens to work against my use cases. Perhaps allowing private access should be limited to double-underscore names, rather than any private name - that would allow access to |
@jazelenk i'm not sure i understand you. |
I agree, but I think that the exceptions carved out right now are overly broad. In the example I show, Object1 and Object2 are sibling classes, yet in the |
@jazelenk there have been a long discussion on #1802 and current pylint's behavior is the result of such discussion. |
@hippo91 Do you think that we can add a new option to the checker to choose between the old and the new behaviour? The original discussion called for disabling the message when in a magic method and when we know that the object with the private attribute being accessed has the same type as the object with the magic method being run. I don't think our current implementation does this, so should we create an issue to add this improvement in the future? |
@AWhetter the idea to have an option is interesting. I'll try to look at this ASAP. In the PR #2959 i tried to detect if there was a |
That's true but I think the point of pylint is to highlight areas of code that could cause problems either because someone is not aware of the problem or someone knows about it but might have missed it when writing this code. |
@Whetter i reopen the issue. I'll try to work on this ASAP. |
protected-access violations previously detected by 2.3.1 are not detected by 2.4.0
Steps to reproduce
Run pylint versus sample.py, which is:
pylint 2.3.1 detects this:
pylint 2.4.0 does not:
I'm not sure if this is related to #2959
The text was updated successfully, but these errors were encountered: