New submission from Nikita Sobolev <m...@sobolevn.me>:

This condition can never be `True`: 
https://github.com/python/cpython/blob/b127e70a8a682fe869c22ce04c379bd85a00db67/Lib/enum.py#L222-L223

Why? Because: 
1. It is executed only when `if not enum_class._use_args_:`: 
https://github.com/python/cpython/blob/b127e70a8a682fe869c22ce04c379bd85a00db67/Lib/enum.py#L215
2. But, `enum_class._use_args_` will always be `False` for cases when 
`enum_class._member_type_` is `object`
3. It is defined here: 
https://github.com/python/cpython/blob/b127e70a8a682fe869c22ce04c379bd85a00db67/Lib/enum.py#L937

So, I guess that removing this condition can simplify the `enum.py`.
Coverage shows that this part is not tested.

I will send a PR shortly.

----------
components: Library (Lib)
messages: 409989
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Unreachable condition: `if enum_class._member_type_ is object`
versions: Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46296>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to