Closed
Description
Hello,
Steps to reproduce
def f(x):
if x == 1:
return 42
assert False
Current behavior
example.py:2:0: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
Expected behavior
No error. This is pretty similar to this issue #1782, except that assert False
is being used. I can currently work around with something like raise RuntimeError('Unreachable')
but assert False
is a common idiom to mark unreachable paths, and should be pretty easy to match.
pylint --version output
pylint 2.6.0
astroid 2.4.2
Python 3.8.7 (default, Dec 24 2020, 17:53:09)
[GCC 10.2.0]