Skip to content

False positive for inconsistent-return-statements #3873

@hippo91

Description

@hippo91

Steps to reproduce

  1. Write following code in a file:
#pylint: disable=missing-module-docstring, missing-function-docstring, blacklisted-name def bar(): pass def foo(): try: bar() return True except IndexError: return False def goose(): try: return True except IndexError: return False 
  1. Lint it

Current behavior

************* Module bug_inco_ret bug_inco_ret.py:5:0: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements) 

Expected behavior

No message should be raised.
This bug seems to have been triggered by #3782. That's why pylint step failed for astroid CI

pylint --version output

pylint 2.6.1-dev1
astroid 2.5.0
Python 3.7.7 (default, Jun 27 2020, 15:03:12)
[GCC 8.3.0]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions