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

W1116 (isinstance-second-argument-not-valid-type) false positive for union types #8205

Closed
randolf-scholz opened this issue Feb 7, 2023 · 0 comments · Fixed by #8206
Closed
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code typing
Milestone

Comments

@randolf-scholz
Copy link

randolf-scholz commented Feb 7, 2023

Bug description

assert isinstance(0, int | str)  # ✘ raises W1116

Configuration

No response

Command used

pylint

Pylint output

************* Module isinstance_second_argument_not_valid_type
bugs/pylint/isinstance_second_argument_not_valid_type.py:1:0: C0114: Missing module docstring (missing-module-docstring)
bugs/pylint/isinstance_second_argument_not_valid_type.py:5:7: W1116: Second argument of isinstance is not a type (isinstance-second-argument-not-valid-type)

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

Expected behavior

Union types are supported by isinstance and issubclass since 3.10 https://docs.python.org/3/library/functions.html#isinstance

Pylint version

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

OS / Environment

No response

Additional dependencies

No response

@randolf-scholz randolf-scholz added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Feb 7, 2023
@nickdrozd nickdrozd added False Positive 🦟 A message is emitted but nothing is wrong with the code typing and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Feb 7, 2023
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 2.16.2, 2.16.3 Feb 7, 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 typing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants