Skip to content

Union type as second arg for isinstance raises W1116 #8381

Closed
@hofrob

Description

@hofrob

Bug description

The following is valid code in python 3.10+ (iirc):

a = 1

isinstance(a, int | str)

Configuration

# default

Command used

pylint --score=n -d all -e W1116 foo.py

Pylint output

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

Expected behavior

No error

Pylint version

$ pylint --version
pylint 2.16.3
astroid 2.14.2
Python 3.11.2 (main, Feb  9 2023, 13:29:03) [GCC 11.3.0]

OS / Environment

Ubuntu 22.04

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    InvalidNot a bug, already exists or already fixed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions