[issue46296] Unreachable condition: `if enum_class._member_type_ is object`

Ethan Furman report at bugs.python.org
Fri Jan 7 15:21:09 EST 2022


Ethan Furman <ethan at stoneleaf.us> added the comment:

(2) is false.

>>> from enum import Enum
>>> 
>>> class MyEnum(Enum):
...     def __new__(cls, value):
...         member = object.__new__(cls)
...         return member
...     ONE = 1
... 

>>> MyEnum.ONE
MyEnum.ONE

>>> MyEnum._use_args_
True

>>> MyEnum._member_type_
<class 'object'>

If coverage shows a branch not being tested, design a test for it instead of removing the branch.

----------
assignee:  -> ethan.furman
nosy: +ethan.furman
stage: patch review -> test needed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46296>
_______________________________________


More information about the Python-bugs-list mailing list