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

2022-01-07 Thread Ethan Furman
Ethan Furman added the comment: Thank you, Nikita! -- resolution: -> fixed stage: test needed -> resolved status: open -> closed ___ Python tracker ___

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

2022-01-07 Thread Ethan Furman
Ethan Furman added the comment: New changeset 74d1663580d1914bd110c3ab7282451f5e2cd2b5 by Nikita Sobolev in branch 'main': bpo-46296: [Enum] add a test for missing `value` recovery (GH-30458) https://github.com/python/cpython/commit/74d1663580d1914bd110c3ab7282451f5e2cd2b5 --

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

2022-01-07 Thread Nikita Sobolev
Nikita Sobolev added the comment: Yes, this is just a missing test. Not a wrong condition! -- components: +Tests -Library (Lib) ___ Python tracker ___

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

2022-01-07 Thread Ethan Furman
Change by Ethan Furman : -- Removed message: https://bugs.python.org/msg410029 ___ Python tracker ___ ___ Python-bugs-list mailing

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

2022-01-07 Thread Ethan Furman
Ethan Furman added the comment: Looking through some of my code that prompted that branch, the issue is caused when `_generate_next_value_` modifies the given args -- when `__set_name__` runs it has no way of getting the same results to automatically create the `_value_` attribute.

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

2022-01-07 Thread Ethan Furman
Ethan Furman 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 >>>

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

2022-01-07 Thread Nikita Sobolev
Change by Nikita Sobolev : -- keywords: +patch pull_requests: +28661 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30458 ___ Python tracker ___

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

2022-01-07 Thread Nikita Sobolev
New submission from Nikita Sobolev : 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_:`: