Message314703
I'm getting the following error at when attempting to create a new `dataclass` with any base class that is supplied a type variable:
TypeError: type() doesn't support MRO entry resolution; use types.new_class()
In principle, it seems like this shouldn't cause any problems, since this works as expected:
@dataclass
class MyClass(Generic[MyTypeVar]):
pass
The problem seems to be the call to `type` in `make_dataclass` for instantiating the class object, since `type` doesn't support type variables. If I replace the `dataclass` line that produces the error with the following code block, it seems to work:
try:
cls = type(cls_name, bases, namespace)
except TypeError:
cls = types.new_class(cls_name, bases, namespace)
I haven't tested, but it might be possible to just remove the call to `type` altogether.
I've attached a file demonstrating the issue. |
|
Date |
User |
Action |
Args |
2018-03-30 18:03:43 | Ricyteach | set | recipients:
+ Ricyteach, eric.smith |
2018-03-30 18:03:43 | Ricyteach | set | messageid: <1522433023.64.0.467229070634.issue33188@psf.upfronthosting.co.za> |
2018-03-30 18:03:43 | Ricyteach | link | issue33188 messages |
2018-03-30 18:03:43 | Ricyteach | create | |
|