benchmark
d856a922 - Add more overloads to `istype` (#175980)

Commit
61 days ago
Add more overloads to `istype` (#175980) Summary: The current overloads for `istype` don't help pyrefly narrow types when it is invoked with a tuple of types. Here is a test case: ``` import torch from torch._dynamo.utils import istype from typing import reveal_type def f(x: object) -> None: if istype(x, (int, float, str)): reveal_type(x) ``` This currently reveals just `object`. Adding overloads for 2- and 3-element tuples (which are pretty common) makes the revealed type `float | int | str`. X-link: https://github.com/pytorch/pytorch/pull/175980 Approved by: https://github.com/Skylion007 Reviewed By: jeanschmidt Differential Revision: D94837136 fbshipit-source-id: 577a4afdc0c1bdcd1e7400351a68d8d892d92bca
Author
generatedunixname499836121
Committer
Parents
Loading