[1/N] Use "is" in python type comparison (#165037)

It generally recommended to use `is/is not` to compare types. Therefore this series of changes apply this suggestion in the code base, and it aims to finally enabling related linter checks.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/165037
Approved by: https://github.com/mlazos
This commit is contained in:
Yuanyuan Chen
2025-10-10 12:36:46 +00:00
committed by PyTorch MergeBot
parent 960b0d5f0d
commit 70925bdf82
37 changed files with 51 additions and 51 deletions

View File

@ -1432,7 +1432,7 @@ class MultiThreadedTestCase(TestCase):
logger.error("Caught exception: \n%s exiting thread %s", msg, rank)
error_msg += f"Thread {rank} exited with exception:\n{msg}\n"
elif isinstance(exc, SystemExit):
if type(exc.code) == int and skip_code < 0:
if type(exc.code) is int and skip_code < 0:
skip_code = exc.code
# check exceptions