[issue33188] dataclass MRO entry resolution for type variable metaclasses: TypeError

Eric V. Smith report at bugs.python.org
Fri Mar 30 15:52:17 EDT 2018


Eric V. Smith <eric at trueblade.com> added the comment:

You can also cause this same error without dataclasses:

from typing import TypeVar, Generic
from types import new_class
MyTypeVar = TypeVar("MyTypeVar")
MyParent = new_class("MyParent", (Generic[MyTypeVar],), {})
c = type('MyChild', (MyParent[int],), {})  # error in 3.8

I assume you get the same error in 3.7, but I can't compile it just now.

The above code works in 3.6. And the code in dataclass_metaclass_issue.py works in 3.6, using the backported dataclasses.py from PyPI.

So it seems this is a typing problem, not a dataclasses problem.

+Ivan, in case he has some insights.

----------
nosy: +levkivskyi

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


More information about the Python-bugs-list mailing list