You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!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.
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?
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.
Originally reported by: Anonymous
Here's the setup I used to check this:
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.
The text was updated successfully, but these errors were encountered: