Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isinstance-second-argument-not-valid-type false positive for union types with None #8424

Closed
ytoku opened this issue Mar 10, 2023 · 0 comments · Fixed by #8549 or #9093
Closed

isinstance-second-argument-not-valid-type false positive for union types with None #8424

ytoku opened this issue Mar 10, 2023 · 0 comments · Fixed by #8549 or #9093
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Good first issue Friendly and approachable by new contributors typing

Comments

@ytoku
Copy link

ytoku commented Mar 10, 2023

Bug description

#8206 does not fix the issue #8205 if the union type contains None.

# pylint: disable=missing-docstring,invalid-name
a = 1
isinstance(a, None | int)  # raises W1116

Configuration

No response

Command used

pylint test.py

Pylint output

************* Module test
test.py:3:0: W1116: Second argument of isinstance is not a type (isinstance-second-argument-not-valid-type)

------------------------------------------------------------------
Your code has been rated at 5.00/10 (previous run: 5.00/10, +0.00)

Expected behavior

no warnings

Pylint version

pylint 2.17.0
astroid 2.15.0
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]

OS / Environment

No response

Additional dependencies

No response

@ytoku ytoku added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Mar 10, 2023
@ytoku ytoku changed the title isinstance-second-argument-not-valid-type false positive for union types **with None** isinstance-second-argument-not-valid-type false positive for union types with None Mar 10, 2023
@ytoku ytoku changed the title isinstance-second-argument-not-valid-type false positive for union types with None isinstance-second-argument-not-valid-type false positive for union types with None Mar 10, 2023
@nickdrozd nickdrozd added Good first issue Friendly and approachable by new contributors typing False Positive 🦟 A message is emitted but nothing is wrong with the code and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Good first issue Friendly and approachable by new contributors typing
Projects
None yet
2 participants