Closed
Description
Describe the bug
In the following code the last line is wrongly considered to be unreachable by Pyright:
from typing import Any
import pandas as pd
def generate_series() -> Any:
return pd.Series([1, 2, 3])
df = pd.concat({k: generate_series() for k in range(10)}, axis=1)
print("Unreachable?!")
This is caused by the recent change #858 adding a stub returning Never
. This is presumably a misuse of Never
or the stub as a whole should be moved to the very end so that concat
on types Iterable[Any]
can first match a stub with valid return.
To Reproduce
See microsoft/pylance-release#5631 and microsoft/pylance-release#5630 for issues reported on the Pylance repo.
Please complete the following information:
- OS: Linux
- OS Version 5.15.0-46-generic
- Python 3.11.6
- Pylance v2024.3.1
- version of installed
pandas-stubs
: the one shipped with above Pylance version