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

False positive unpacking-non-sequence on classmethod + property #4803

Open
rominf opened this issue Aug 5, 2021 · 1 comment
Open

False positive unpacking-non-sequence on classmethod + property #4803

rominf opened this issue Aug 5, 2021 · 1 comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation

Comments

@rominf
Copy link

rominf commented Aug 5, 2021

Bug description

class E:
    @classmethod
    @property
    def p(cls):
        return 0, 42


x, y = E.p

Configuration

No response

Command used

pylint a.py

Pylint output

************* Module a
a.py:8:0: E0633: Attempting to unpack a non-sequence defined at line 2 (unpacking-non-sequence)

Expected behavior

No output, it's allowed in Python 3.9: https://docs.python.org/3/library/functions.html#classmethod

Pylint version

pylint 2.9.6
astroid 2.6.6
Python 3.9.6 (default, Jul 16 2021, 00:00:00) 
[GCC 10.3.1 20210422 (Red Hat 10.3.1-1)

OS / Environment

Fedora 33

Additional dependencies

No response

@rominf rominf added Bug 🪲 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Aug 5, 2021
@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Aug 5, 2021
@Pierre-Sassoulas Pierre-Sassoulas added Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Bug 🪲 labels Jul 2, 2022
@luinnar
Copy link

luinnar commented Feb 27, 2024

This also applies to "standard" class properties:

class Test:
    OPTIONAL_TUPLE: tuple[str, str] | None = None

    def test(self) -> None:
        if self.OPTIONAL_TUPLE is None or len(self.OPTIONAL_TUPLE) != 2:
            raise ValueError("No, no, no")

        _, var1 = self.OPTIONAL_TUPLE
types.py:11:8: E0633: Attempting to unpack a non-sequence defined at line 5 (unpacking-non-sequence)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

No branches or pull requests

3 participants