You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two overloaded versions of function: the first version for AsyncContextManager parameter, the second version for Callable with ParamSpec.
Static type checker must choose the first version, but it chooses the second one.
BUT: after removing ParamSpec from function signature, mypy ends up working well (see the comment in example).
Note: pyright (v. 1.1.386) works just fine on it.
Possibly related to #17960
Expected Behavior
mypy has not reported any issue with such overloaded functions, and should still not report as it was for mypy prior to 1.12.0.
Actual Behavior
main.py:58: error: Incompatible types in assignment (expression has type"str", variable has type"Animal") [assignment]
Found 1 error in 1 file (checked 1 source file)
Your Environment
Mypy version used: 1.12.0, 1.12.1, 1.13.0
Mypy command-line flags: N/A
Mypy configuration options from mypy.ini (and other config files): N/A
Python version used: 3.8, 3.9, 3.10, 3.11, 3.12
The text was updated successfully, but these errors were encountered:
Caused by overload filtering logic change in #17323, but does not relate to #17960 which is specific to functools.partial and does not concern overloads, they don't share the same underlying problem.
Bug Report
There are two overloaded versions of function: the first version for
AsyncContextManager
parameter, the second version forCallable
with ParamSpec.Static type checker must choose the first version, but it chooses the second one.
BUT: after removing
ParamSpec
from function signature, mypy ends up working well (see the comment in example).Note: pyright (v. 1.1.386) works just fine on it.
Possibly related to #17960
To Reproduce
Live playground link
Expected Behavior
mypy has not reported any issue with such overloaded functions, and should still not report as it was for mypy prior to 1.12.0.
Actual Behavior
Your Environment
mypy.ini
(and other config files): N/AThe text was updated successfully, but these errors were encountered: