pylint-dev/pylint

Using return value of a function that returns None is not always reported.

Open

#10 476 ouverte le 5 août 2025

Voir sur GitHub
 (5 commentaires) (0 réactions) (1 assigné)Python (1 059 forks)batch import
False Negative 🦋Good first issueHacktoberfestHelp wanted 🙏Needs specification :closed_lock_with_key:

Métriques du dépôt

Stars
 (4 978 stars)
Métriques de merge PR
 (Merge moyen 58j 21h) (63 PRs mergées en 30 j)

Description

Bug description

def f1(i: int) -> None:
    print(i)


def f2() -> None:
    r = f1(2)  # assignment-from-no-return
    if not r:
        print("error")
    if not f1(2):  # no error
        print("error")

Configuration

Command used

pylint experiments/type_test.py -E

Pylint output

experiments/type_test.py:6:4: E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return)

Expected behavior

In the code snippet, line 6 will report an error, but line 9 doesn't. I'd expect to see an error on line 9, since the code essentially does the same thing. Not sure whether this is by design or a bug. If it's by design, feel free to change this issue to a feature request.

Pylint version

pylint 3.3.7
astroid 3.3.10
Python 3.13.5 (main, Jun 11 2025, 15:36:57) [Clang 17.0.0 (clang-1700.0.13.3)]

OS / Environment

MacOS 15.5

Additional dependencies

Guide contributeur