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

Type of enum value being incorrectly inferred #744

Open
ltcmelo opened this issue Jan 20, 2020 · 0 comments · May be fixed by #1598
Open

Type of enum value being incorrectly inferred #744

ltcmelo opened this issue Jan 20, 2020 · 0 comments · May be fixed by #1598

Comments

@ltcmelo
Copy link
Contributor

ltcmelo commented Jan 20, 2020

Note: this content is roughly equivalent to that of an still unanswered question I posted at SO.

from enum import Enum

class Whatever(Enum):
    Foo = 1
    Bar = 2

def f():
    x = Whatever.Foo

Consider the program above an a call to infer() on expression Whatever.Foo.

Current behavior

I get a (proxied) ClassDef for a Foo "type".

Expected behavior

I'd expect a (proxied) ClassDef for Whatever.

This would be according to the language specification, that says that the type of an enumeration member is the enumeration it belongs to.

astroid version: 2.3.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant