Skip to content

FURB168 has false positives on empty tuples #19047

@dscorbett

Description

@dscorbett

Summary

isinstance-type-none (FURB168) has false positives when the tuples it checks are empty. () is not the same as None.

Playground

$ 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
True

Version

ruff 0.12.1 (32c5418 2025-06-26)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions