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
TypeVar with union bound changes return type of type(t)() #18478
I'd expect that for any t: T, you should be able to call type(t)() and it should either returnT or raise an exception. This seems to be true in most cases, but when using a TypeVar with a union bound it seems to be falling back to the union value.
To Reproduce
I've put together three functions that I believe to be practically equivalent:
Activity
ilevkivskyi commentedon Aug 3, 2025
I think this is a duplicate of #14790
type[TypeVar]with upper bound not checked correctly (false positive) #14790