[New-bugs-announce] [issue47111] ENUM TypeError using mixing

Benyamin Guedj report at bugs.python.org
Thu Mar 24 09:43:49 EDT 2022


New submission from Benyamin Guedj <benyamin621 at gmail.com>:

when trying to implement mixing with enum

```python
from typing import Tuple
from enum import Enum
class Blah(Tuple[str, ...], Enum):
    val = ('a', 'b')
```


>>> from typing import Tuple
>>> from enum import Enum
>>> class Blah(Tuple[str, ...], Enum):
...     val = ('a', 'b')
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\enum.py", line 150, in __prepare__
    member_type, first_enum = metacls._get_mixins_(cls, bases)
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\enum.py", line 574, in _get_mixins_
    member_type = _find_data_type(bases) or object
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\enum.py", line 562, in _find_data_type
    raise TypeError('%r: too many data types: %r' % (class_name, data_types))
TypeError: 'Blah': too many data types: [<class 'tuple'>, <class 'typing.Generic'>]


note:
  the same code work on python 3.7, 3.9, 3.10



I have checked the source code of enum of 3.8

https://github.com/python/cpython/blob/3.8/Lib/enum.py

and it's not the same as the other version 

https://github.com/python/cpython/blob/3.9/Lib/enum.py

----------
components: Library (Lib)
messages: 415942
nosy: benyamin621
priority: normal
severity: normal
status: open
title: ENUM TypeError using mixing
type: crash
versions: Python 3.8

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


More information about the New-bugs-announce mailing list