Skip to content

Redundant if statement in EnumType._find_data_type_() in enum.py #103215

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

Closed
sadra-barikbin opened this issue Apr 3, 2023 · 1 comment · Fixed by #103222
Closed

Redundant if statement in EnumType._find_data_type_() in enum.py #103215

sadra-barikbin opened this issue Apr 3, 2023 · 1 comment · Fixed by #103222
Labels
stdlib Python modules in the Lib dir

Comments

@sadra-barikbin
Copy link
Contributor

sadra-barikbin commented Apr 3, 2023

This statement is redundant:

cpython/Lib/enum.py

Lines 996 to 997 in 8236222

if isinstance(base, EnumType):
continue

in

cpython/Lib/enum.py

Lines 990 to 997 in 8236222

continue
elif isinstance(base, EnumType):
if base._member_type_ is not object:
data_types.add(base._member_type_)
break
elif '__new__' in base.__dict__ or '__init__' in base.__dict__:
if isinstance(base, EnumType):
continue

Linked PRs

@sadra-barikbin sadra-barikbin changed the title Redundant if statement in EnumType._find_data_type_() in enum.py' Redundant if statement in EnumType._find_data_type_() in enum.py Apr 3, 2023
@arhadthedev arhadthedev added the stdlib Python modules in the Lib dir label Apr 3, 2023
@sobolevn
Copy link
Member

sobolevn commented Apr 3, 2023

Yes, looks like it is! Line

if isinstance(base, EnumType):
cannot be reached, because it is covered by
elif isinstance(base, EnumType):

Would you like to submit a PR? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants