-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
Summary
isinstance-type-none (FURB168) has false positives when the tuples it checks are empty. () is not the same as None.
$ cat >furb168.py <<'# EOF'
from typing import Union
print(isinstance(None, ()))
try:
print(isinstance(None, Union[()]))
except TypeError as e:
print(f"{type(e).__name__}: {e}")
# EOF
$ python furb168.py
False
TypeError: Cannot take a Union of no types.
$ ruff --isolated check furb168.py --select FURB168 --fix
Found 2 errors (2 fixed, 0 remaining).
$ cat furb168.py
from typing import Union
print((None is None))
try:
print((None is None))
except TypeError as e:
print(f"{type(e).__name__}: {e}")
$ python furb168.py
True
TrueVersion
ruff 0.12.1 (32c5418 2025-06-26)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingruleImplementing or modifying a lint ruleImplementing or modifying a lint rule