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 — `__new__` return types are not respected (reported as error and overwritten by the current class) unless the return type is a subclass of the current class · Issue #19624 · python/mypy Closed as duplicate Labels bugmypy got something wrong Description
from typing import cast class A: def __new__(cls) -> int: return 1 class B: def __new__(cls) -> "C": return cast(C, None) class C(B): def __new__(cls) -> B: return cast(B, None) reveal_type(A()) # Expect int (builtin.int) reveal_type(B()) # Expect C (new.C) reveal_type(C()) # Expect B (new.B) Run mypy new.py --config-file= (The Expected: Actual: Environment
Related issues Same: #1020 #15182 #8330 (Note: Some of these issues are noted as no longer reproducable in the comments. I didn't check their reproducability, but I am able to reproduce this one, which might mean a regression.) ActivityMetadataMetadataAssigneesLabelsbugmypy 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. |