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

Enum: Instance of 'int' has no 'value' member (no-member) #2224

Closed
zhongshangwu opened this issue Jun 26, 2018 · 8 comments · Fixed by pylint-dev/astroid#1121
Closed

Enum: Instance of 'int' has no 'value' member (no-member) #2224

zhongshangwu opened this issue Jun 26, 2018 · 8 comments · Fixed by pylint-dev/astroid#1121
Labels
Bug 🪲 Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade)

Comments

@zhongshangwu
Copy link

Steps to reproduce

#! python3

from enum import Enum

class BaseEnum(Enum):

    def some_behavior(self):
        pass

class MyEnum(BaseEnum):

    FOO = 1
    BAR = 2

print(MyEnum.FOO.value)

Run pylint on the above file.

Current behavior

E: 16, 0: Instance of 'int' has no 'value' member (no-member)

Expected behavior

No error.

(Subclassing an enumeration is allowed only if the enumeration does not define any members. )

pylint --version output

No config file found, using default configuration
pylint 1.9.1,
astroid 1.6.2
Python 3.6.0 (default, Apr  2 2018, 14:01:47)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)]
@PCManticore PCManticore added Bug 🪲 Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade) labels Jun 28, 2018
@PCManticore
Copy link
Contributor

Thank you for the report!

@belm0
Copy link
Contributor

belm0 commented Jan 23, 2019

Notably, this affects enum.Flag and other standard classes which derive from Enum.

class Foo(enum.Flag):
    NONE = 0
    BAR = 1
    BAZ = 2

print(Foo.NONE.value)

@belm0
Copy link
Contributor

belm0 commented Mar 4, 2019

I believe it's fixed in a recent release.

@jupe
Copy link

jupe commented Oct 16, 2019

Which release?

@ghobolds
Copy link

Still happening in version 2.4.3.

@Qu4tro
Copy link

Qu4tro commented Jan 2, 2020

Just found the issue in 2.4.4

@alvarolloret
Copy link

same here, will it be updated?

@wagdez
Copy link

wagdez commented Oct 12, 2020

any update on this?
still happens in
pylint 2.6.0
astroid 2.4.2
Python 3.8.6 (default, Sep 24 2020, 22:01:47)
[GCC 9.3.0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants