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 — `functools.partialmethod` loses return type and callable signature information · Issue #16499 · python/typeshed Open DescriptionFor code of this shape: from functools import partialmethod def pprint(arg: object, /, *, options: dict) -> str: return "dummy" class Foo: ... class Bar: ... Bar.__repr__ = partialmethod(pprint, options={}) it is difficult for type checkers to verify that class partialmethod(Generic[_T]): ... def __get__(self, obj: Any, cls: type[Any] | None = None) -> Callable[..., _T]: ... The current stub does not preserve the wrapped callable’s parameters or receiver type, so type checkers cannot model these class and instance access forms even though this ebhaviour is valid at runtime, and Bar.__repr__ # T: (self: Bar) -> str Bar().__repr__ # T: () -> str This forces Pyrefly and Pyright to reject this valid code. Mypy on the other hand, looks at stub’s descriptor fallback ( We should preserve descriptor binding and as much callable information as possible, while accepting that a fully precise residual signature needs typing-spec support. Born from Pyrefly issue, meta/pyrefly#5138 ActivityMetadataMetadataAssigneesLabelsNo labels ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — 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. |