#1148334 python3-hypothesis and pylint have incompatible understanding of the assume type employing NoReturn

Package:
pylint
Source:
pylint
Submitter:
Helmut Grohne
Date:
2026-09-18 19:07:04 UTC
Severity:
normal
Tags:
#1148334#5
Date:
2026-09-16 06:51:59 UTC
From:
To:
Hello,

hypothesis declares assume as follows.
https://sources.debian.org/src/python-hypothesis/6.155.7-1/hypothesis/src/hypothesis/control.py?hl=57&pow_referer=https%3A%2F%2Fcodesearch.debian.net%2F#L57
| @overload
| def assume(condition: Literal[False] | None) -> NoReturn: ...
| @overload
| def assume(condition: object) -> Literal[True]: ...
|
| def assume(condition: object) -> Literal[True]: ...

For some reason, pylint sees the NoReturn and reports unreachable code
for anything that follows hypothesis.assume(...). This has been reported
upstream and fixed there and is supposedly fixed via
https://github.com/pylint-dev/pylint/pull/10795. That was in December
2025 and pylint has been uploaded quite recently. Looking at the source
(of 4.0.6-1), it looks applied, but the problem persists. Any idea what
went wrong here?

The following code triggers the bug.

| import hypothesis, hypothesis.strategies
| @hypothesis.given(hypothesis.strategies.integers())
| def test_bug(value: int) -> None:
|     hypothesis.assume(value > 0)
|     assert value > 0

We get:

| bug.py:5:4: W0101: Unreachable code (unreachable)

Helmut