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
{{ message }}
Repository navigation
[1.12, 1.13 regression] typing.overload and ParamSpec #18027
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
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.
Activity
JukkaL commentedon Oct 24, 2024
This bisects to #17323.
@sterliakov Could you have a look at this?
sterliakov commentedon Oct 24, 2024
Yes, sure! I'll try to fix this today.
Caused by overload filtering logic change in #17323, but does not relate to #17960 which is specific to
functools.partialand does not concern overloads, they don't share the same underlying problem.Do not prioritize ParamSpec signatures during overload resolution (py…