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
Wrong type narrowing when using type without an argument in isinstance call #13462
@ilevkivskyi How exactly #19183 closed this one?
I still see the same error in the pretty brain dead scenarios.
def rename_deep(self, data: T, col_map: dict[str, str]) -> T:
if isinstance(data, str):
return self.rename_all(data, col_map)
if isinstance(data, dict):
return {key: self.rename_deep(value, col_map) for key, value in data.items()}
if isinstance(data, list):
return [self.rename_deep(item, col_map) for item in data]
return data
error: Incompatible return value type (got "str", expected "T") [return-value]
error: Incompatible return value type (got "dict[Any, Any]", expected "T") [return-value]
error: Incompatible return value type (got "list[Any]", expected "T") [return-value]
Activity
kellerza commentedon Jul 25, 2024
Adding a constraint to the TypeVar seems to help
Narrow type variable bounds in binder (python#19183)
pkit commentedon Aug 16, 2025
@ilevkivskyi How exactly #19183 closed this one?
I still see the same error in the pretty brain dead scenarios.
Using mypy
1.17.1which should include #19183