it is difficult for type checkers to verify that partialmethod is compatible with the target method since it is currently typed with only a return-type parameter:
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 partialmethod is a descriptor:
This forces Pyrefly and Pyright to reject this valid code. Mypy on the other hand, looks at stub’s descriptor fallback (Any) and infers partialmethod[Any] even when the wrapped callable returns str.
We should preserve descriptor binding and as much callable information as possible, while accepting that a fully precise residual signature needs typing-spec support.
Activity