Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENUM TypeError using mixing #91267

Closed
benyamin621 mannequin opened this issue Mar 24, 2022 · 2 comments
Closed

ENUM TypeError using mixing #91267

benyamin621 mannequin opened this issue Mar 24, 2022 · 2 comments
Assignees
Labels
3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@benyamin621
Copy link
Mannequin

benyamin621 mannequin commented Mar 24, 2022

BPO 47111
Nosy @ethanfurman

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2022-03-24.13:43:49.587>
labels = ['3.8', 'library', 'type-crash']
title = 'ENUM TypeError using mixing'
updated_at = <Date 2022-03-24.14:49:14.168>
user = 'https://bugs.python.org/benyamin621'

bugs.python.org fields:

activity = <Date 2022-03-24.14:49:14.168>
actor = 'ethan.furman'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2022-03-24.13:43:49.587>
creator = 'benyamin621'
dependencies = []
files = []
hgrepos = []
issue_num = 47111
keywords = []
message_count = 1.0
messages = ['415942']
nosy_count = 2.0
nosy_names = ['ethan.furman', 'benyamin621']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue47111'
versions = ['Python 3.8']

@benyamin621
Copy link
Mannequin Author

benyamin621 mannequin commented Mar 24, 2022

when trying to implement mixing with enum

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

@benyamin621 benyamin621 mannequin added 3.8 only security fixes stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump labels Mar 24, 2022
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@AlexWaygood AlexWaygood added type-bug An unexpected behavior, bug, or error and removed type-crash A hard crash of the interpreter, possibly with a core dump labels Apr 13, 2022
@ethanfurman
Copy link
Member

3.8 is now only accepting security fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants