From https://github.com/python/typeshed/issues/8372 ``` from typing import Callable, TypeVar, Any, Mapping, Optional T = TypeVar("T", bound=Mapping[str, Any]) def raises(opts: Optional[T]) -> T: pass def assertRaises(cb: Callable[..., object]) -> None: pass assertRaises(raises) ```
Activity
Use Callable[..., Any] instead of Callable[..., object]
Akuli commentedon Oct 14, 2022
Slightly simpler reproducer:
Expected result: no error because
Callable[..., object]should accept any callable, even withTypeVars in it.Actual result: assignment on last line fails.
Use upper bounds as fallback solutions for inference (#16184)