GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Inconsistent MRO error when `__new__` returns a subclass and `--warn-unreachable` is turned on · Issue #13824 · python/mypy Closed Labels bugmypy got something wrong DescriptionBug Report The problem appeared in the pandas stubs in this issue: pandas-dev/pandas-stubs#269 There, I was told to report it here. To Reproduce Playground URL: https://mypy-play.net/?mypy=master&python=3.10&flags=warn-unreachable&gist=18e35c8047f69e2418498f85cc8f02d0 from __future__ import annotations import datetime from typing import Any, Generic, TypeVar, Union, overload S1 = TypeVar("S1", int, datetime.datetime) class Series(Generic[S1]): @overload def __new__(cls, data: datetime.datetime) -> TimestampSeries: ... @overload def __new__(cls, data: dict[int, S1]) -> Series[S1]: ... def __new__(cls, data: Union[datetime.datetime, dict[int, S1]]) -> Any: return class TimestampSeries(Series[datetime.datetime]): ... x = Series({0: 0, 1: 1}) reveal_type(x) assert isinstance(x, Series) Note that the error only appears with Expected Behavior Given that the Actual Behavior Your Environment See the mypy playground link. Activity
MetadataMetadataAssigneesLabelsbugmypy got something wrong ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |