pandas-stubs: Mypy complains about inconsistent MRO when using `isinstance()` on a generic `Series` object

To Reproduce

import pandas as pd

x: pd.Series[int] = pd.Series([1, 3, 4], name="my series")
assert isinstance(x, pd.Series)  # this line produces the error below

mypy gives the following error:

repro.py:4: error: Subclass of "Series[int]" and "TimestampSeries" cannot exist: would have inconsistent method resolution order  [unreachable]

pyright does not complain. Nor does mypy complain if I drop the [int] for pd.Series.

Please complete the following information:

  • OS: Linux
  • OS Version: Ubuntu 22.04
  • python version: 3.10.4
  • version of type checker: mypy 0.971
  • version of installed pandas-stubs: 1.4.3.220829

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments