Skip to content

inconsistent-return-statements not working in try branches #3468

@joshuahaertel

Description

@joshuahaertel

Steps to reproduce

Add a return in the try clause

def foo(bar): try: return bar.baz except AttributeError: pass 

Current behavior

Pylint emits no warning for inconsistent-return-statements. Note that it will emit a warning if the value is returned in the except clause.

Expected behavior

Pylint should emit a warning for not explicitly returning a value if an exception is hit, be it in the except clause itself or at the end of the call.

pylint --version output

$ pylint --version output pylint 2.4.4 astroid 2.3.3 Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] 

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions