Skip to content

Mypy complains about inconsistent MRO when using isinstance() on a generic Series object #269

Open
@tmke8

Description

@tmke8

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    mypy bugRequires mypy to fix a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions