-
-
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
methods that return a sequence yield unpacking-non-sequence #4696
Comments
From my investigation so far, this doesn't seem to be related to
then astroid will infer that the It seems that the immediate cause of astroid picking the wrong declaration is the code in
The two member function definitions have different scopes, so the subsequent ones are discarded and only the first (incorrect) one is kept. This scope code was added in this commit, to deal with a case where a class member is defined and then later |
I've made some progress on this, but my approach is hitting a lot of problems. The obvious solution seems to be to change it to:
so that we're comparing
Only the first defintion is seen. When the setter is accessed via I can see how this might be addressed, but it seems like a major piece of work to chase down all these other issues. Does anyone with more astroid experience want to weigh in on whether this is a good idea? |
Thanks for the writeup. Will handle in pylint-dev/astroid#1015 |
If you unpack a sequence return value of a method, pylint falsely reports unpacking-non-sequence. It seems to work correctly with functions.
The issue is introduced with
pylint==2.9.0
and happens with all later versions, including the currentpylint==3.0.0a4
. It does not happen withpylint==2.8.3
, which is why I think this is a different issue from the similar looking #4137 (which mentions 2.7.0).Steps to reproduce
The below example shows a minimal showcase of the false positive for methods and also shows that the error does not happen with functions.
When you invoke pylint on this file, the second line will show the false positive (and not the first one):
The text was updated successfully, but these errors were encountered: