Skip to content

ABC abstract properties raise W0633 when unpacked #496

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

Closed
pylint-bot opened this issue Mar 19, 2015 · 2 comments
Closed

ABC abstract properties raise W0633 when unpacked #496

pylint-bot opened this issue Mar 19, 2015 · 2 comments
Labels

Comments

@pylint-bot
Copy link

Originally reported by: Anonymous


Here's the setup I used to check this:

#!python

"""
Test linting rule W0633.
"""

import abc


class TestClass(object):
    __metaclass__ = abc.ABCMeta

    def unpack(self):
        try:
            i, j = self.a # raises W0633
            x, y = self.b # doesn't raise W0633
        except ValueError:
            return

        print i, j, x, y

    @abc.abstractproperty
    def a(self):
        raise NotImplementedError

    @property
    def b(self):
        raise NotImplementedError

Currently the abstract property triggers W0633 but the built-in property does not. This behaviour seems strange given that abc.abstractproperty is a subclass of the builtin property. Neither should be raising this warning.


@pylint-bot
Copy link
Author

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Using the latest astroid tip, you won't see the warning for the abstractproperty anymore. But what really happens here is that pylint will raise InferenceError when a function doesn't return anything, as it is the case for these two properties. So there's one question left. Should pylint emit W0633 for these cases, as they aren't returning a sequence at all or should we consider them abstract and ignore them?

@pylint-bot
Copy link
Author

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


I'll close the issue, the bug was fixed. Currently there many more checks which needs to handle the case where a function only raises an error and returns nothing, so we'll handle that later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant