This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients ethan.furman, larry, ncoghlan, rhettinger, serhiy.storchaka, xiang.zhang, yselivanov
Date 2017-01-24.18:40:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485283207.83.0.870729520965.issue29363@psf.upfronthosting.co.za>
In-reply-to
Content
This line is came from the signature of the __call__ method.

>>> import enum, inspect
>>> class A(enum.Enum):
...    x = 1
... 
>>> inspect.signature(A)
<Signature (value, names=None, *, module=None, qualname=None, type=None, start=1)>
>>> inspect.signature(A.__call__)
<Signature (value, names=None, *, module=None, qualname=None, type=None, start=1)>
>>> inspect.signature(enum.EnumMeta.__call__)
<Signature (cls, value, names=None, *, module=None, qualname=None, type=None, start=1)>

But calling A with optional arguments doesn't work.

>>> A(1)
<A.x: 1>
>>> A('B', {'y': 2})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/cpython/Lib/enum.py", line 293, in __call__
    return cls._create_(value, names, module=module, qualname=qualname, type=type, start=start)
  File "/home/serhiy/py/cpython/Lib/enum.py", line 378, in _create_
    _, first_enum = cls._get_mixins_(bases)
  File "/home/serhiy/py/cpython/Lib/enum.py", line 436, in _get_mixins_
    raise TypeError("Cannot extend enumerations")
TypeError: Cannot extend enumerations
History
Date User Action Args
2017-01-24 18:40:07serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, ncoghlan, larry, ethan.furman, yselivanov, xiang.zhang
2017-01-24 18:40:07serhiy.storchakasetmessageid: <1485283207.83.0.870729520965.issue29363@psf.upfronthosting.co.za>
2017-01-24 18:40:07serhiy.storchakalinkissue29363 messages
2017-01-24 18:40:07serhiy.storchakacreate