Package: pylint
Version: 4.0.6-1
Tags: upstream
Forwarded: https://github.com/pylint-dev/pylint/issues/10785
Control: affects -1 + python3-hypothesis

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

Reply via email to