typing: allow integer in bitwise operations (#155704)

Fixes #155701 (false positives)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/155704
Approved by: https://github.com/Skylion007, https://github.com/aorenste
This commit is contained in:
Randolf Scholz
2025-06-12 22:40:12 +00:00
committed by PyTorch MergeBot
parent 938515fa75
commit f04fd4dc4e
3 changed files with 11 additions and 44 deletions

View File

@ -261,7 +261,7 @@ def sig_for_ops(opname: str) -> list[str]:
]
return [f"def {opname}(self, other: Tensor | Number | _complex) -> Tensor: ..."]
elif name in logic_ops:
return [f"def {opname}(self, other: Tensor | _bool) -> Tensor: ..."]
return [f"def {opname}(self, other: Tensor | _int) -> Tensor: ..."]
elif name in shift_ops:
return [f"def {opname}(self, other: Tensor | _int) -> Tensor: ..."]
elif name in symmetric_comparison_ops: