#4619·ty

Explicit gradual receiver annotation (`self: Any`) leads to error

Author: sharkdpCreated Sep 29, 2026Updated Sep 29, 2026
Labelsbuggenericscallablesmethod-receiver

This seems to be related to gradual constraints, but it doesn't seem like #4536 describes this case, so I'm reporting it separately (FYI @ibraheemdev):

python
from typing import Any, Callable

class C:
    def method(self: Any) -> None:
        pass

    def test(self) -> None:
        # Object of type `bound method [email protected]() -> None` is not assignable to `() -> None`
        callback: Callable[[], None] = self.method
        callback()

When Any annotation is removed, or replaced with Self or object, the error goes away.