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
Non-overlapping identity check error for typing.get_origin #10405
My (untested) guess would be that because TypeSpec is an alias for Any, any of the get_origin overloads are a valid match for the code snippet above. So mypy just blindly picks the first overload, and infers that the object returned by the get_origin call is an instance of ParamSpec.
Activity
JelleZijlstra commentedon Jul 5, 2023
We already have a series of overloads for different cases, and the
typereturn is only forGenericAliasarguments:typeshed/stdlib/typing.pyi
Line 812 in 7646d38
I think this might be better seen as a bug in mypy, or at least an unfortunate overload resolution.
AlexWaygood commentedon Jul 8, 2023
My (untested) guess would be that because
TypeSpecis an alias forAny, any of theget_originoverloads are a valid match for the code snippet above. So mypy just blindly picks the first overload, and infers that the object returned by theget_origincall is an instance ofParamSpec.typeshed/stdlib/typing.pyi
Lines 813 to 814 in 7646d38
This is indeed slightly unfortunate, but I'm not sure what we can do about it.
eltoder commentedon Jul 9, 2023
Alright, opened a mypy bug: python/mypy#15630
AlexWaygood commentedon Jul 22, 2023
Going to close this, as I don't think there's anything actionable for typeshed here; this is a mypy bug