-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violationshelp wantedContributions especially welcomeContributions especially welcome
Description
Summary
When all the elements of a Union are None, the fix for duplicate-union-member (PYI016) introduces a TypeError. Example:
$ cat >pyi016.py <<'# EOF'
from typing import Union
isinstance(None, Union[None, None])
# EOF
$ ruff --isolated check pyi016.py --select PYI016 --fix
Found 1 error (1 fixed, 0 remaining).
$ cat pyi016.py
from typing import Union
isinstance(None, None)
$ python pyi016.py 2>&1 | tail -n 1
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a unionVersion
ruff 0.12.3 (5bc81f2 2025-07-11)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violationshelp wantedContributions especially welcomeContributions especially welcome