Skip to content

pylint false positive - Instance of 'str' has no 'value' member (no-member) #8897

@mdeshmu

Description

@mdeshmu

Bug description

For the following piece of code pylint gives the error: E1101: Instance of 'str' has no 'value' member (no-member) in python 3.9 and 3.10 but doesn't gives this error in python 3.11, While the code itself works fine. It seems like a false positive for us.

import sys from enum import Enum if sys.version_info >= (3, 11): from enum import StrEnum else: class StrEnum(str, Enum): pass class FilterOperator(StrEnum): IN = "IN" print(FilterOperator.IN.value) 

Configuration

https://github.com/apache/superset/blob/master/.pylintrc

Command used

pylint -E enum_test.py

Pylint output

E1101: Instance of 'str' has no 'value' member (no-member)

Expected behavior

pylint should be able to recognize value retrieval for the Enum member.

Pylint version

pylint 2.17.5 astroid 2.15.6 Python 3.9.5 or Python 3.10.6

OS / Environment

Linux Based Operating Systems

Additional dependencies

No response

Metadata

Metadata

Assignees

Labels

Crash 💥A bug that makes pylint crashNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationNeeds astroid updateNeeds an astroid update (probably a release too) before being mergable

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions