Issue30616
Created on 2017-06-09 17:30 by Gerrit.Holl, last changed 2017-08-17 08:57 by vstinner. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 2304 | merged | corona10, 2017-06-20 16:17 | |
| PR 2324 | merged | corona10, 2017-06-22 03:04 | |
| PR 2888 | closed | corona10, 2017-07-26 06:40 | |
| PR 2889 | closed | corona10, 2017-07-26 07:03 | |
| Messages (5) | |||
|---|---|---|---|
| msg295559 - (view) | Author: Gerrit Holl (Gerrit.Holl) * | Date: 2017-06-09 17:30 | |
The OO API allows to create empty enums, i.e. without any values. However, the functional API does not, as this will result in an IndexError as shown below:
In [1]: import enum
In [2]: class X(enum.IntFlag): pass
In [3]: Y = enum.IntFlag("Y", [])
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-3-1fda5945e0b2> in <module>()
----> 1 Y = enum.IntFlag("Y", [])
~/lib/python3.6/enum.py in __call__(cls, value, names, module, qualname, type, start)
291 return cls.__new__(cls, value)
292 # otherwise, functional API: we're creating a new Enum type
--> 293 return cls._create_(value, names, module=module, qualname=qualname, type=type, start=start)
294
295 def __contains__(cls, member):
~/lib/python3.6/enum.py in _create_(cls, class_name, names, module, qualname, type, start)
382 if isinstance(names, str):
383 names = names.replace(',', ' ').split()
--> 384 if isinstance(names, (tuple, list)) and isinstance(names[0], str):
385 original_names, names = names, []
386 last_values = []
IndexError: list index out of range
|
|||
| msg296567 - (view) | Author: Ethan Furman (ethan.furman) * | Date: 2017-06-21 16:52 | |
New changeset dcc8ce44c74492670e6bfbde588a2acbf8f365e0 by ethanfurman (Dong-hee Na) in branch 'master': bpo-30616: Functional API of enum allows to create empty enums. (#2304) https://github.com/python/cpython/commit/dcc8ce44c74492670e6bfbde588a2acbf8f365e0 |
|||
| msg296569 - (view) | Author: Ethan Furman (ethan.furman) * | Date: 2017-06-21 16:58 | |
3.7 fixed, now need 3.6. |
|||
| msg296776 - (view) | Author: Ethan Furman (ethan.furman) * | Date: 2017-06-24 16:12 | |
New changeset 504b95047a8ada06ab630abce55ac2f85566ca37 by ethanfurman (Dong-hee Na) in branch '3.6': [3.6] bpo-30616: Functional API of enum allows to create empty enums. (#2304) (#2324) https://github.com/python/cpython/commit/504b95047a8ada06ab630abce55ac2f85566ca37 |
|||
| msg300404 - (view) | Author: STINNER Victor (vstinner) * | Date: 2017-08-17 08:57 | |
Thanks for the bugreport Gerrit Holl and thanks for fixes Dong-hee Na! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2017-08-17 08:57:32 | vstinner | set | status: open -> closed nosy:
+ vstinner resolution: fixed |
| 2017-07-26 07:03:38 | corona10 | set | pull_requests: + pull_request2941 |
| 2017-07-26 06:40:07 | corona10 | set | pull_requests: + pull_request2940 |
| 2017-06-24 16:12:22 | ethan.furman | set | messages: + msg296776 |
| 2017-06-22 03:04:38 | corona10 | set | pull_requests: + pull_request2373 |
| 2017-06-21 16:58:43 | ethan.furman | set | messages:
+ msg296569 stage: test needed -> backport needed |
| 2017-06-21 16:52:35 | ethan.furman | set | messages: + msg296567 |
| 2017-06-20 16:17:35 | corona10 | set | pull_requests: + pull_request2351 |
| 2017-06-09 17:58:23 | ethan.furman | set | priority: normal -> low assignee: ethan.furman stage: test needed components: + Library (Lib) versions: + Python 3.7 |
| 2017-06-09 17:55:54 | ethan.furman | set | nosy:
+ ethan.furman |
| 2017-06-09 17:30:17 | Gerrit.Holl | create | |