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

2018-04-06 Thread Ivan Levkivskyi
Change by Ivan Levkivskyi : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

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

2018-03-31 Thread miss-islington
Change by miss-islington : -- pull_requests: +6036 ___ Python tracker ___

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

2018-03-31 Thread Eric V. Smith
Eric V. Smith added the comment: Yeah, no need to change the API. I was over-generalizing. -- ___ Python tracker ___

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

2018-03-31 Thread Ivan Levkivskyi
Change by Ivan Levkivskyi : -- keywords: +patch pull_requests: +6035 stage: -> patch review ___ Python tracker ___

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

2018-03-30 Thread Rick Teachey
Rick Teachey added the comment: I'll also say: one of the biggest reasons I was excited to read the `dataclasses` PEP was because I thought "AWESOME! Now I can delete all of the stupid boilerplate __init__ and __repr__ methods for those `typing.Sequences`,

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

2018-03-30 Thread Rick Teachey
Rick Teachey added the comment: > passing keyword arguments to metaclass will be much more rare for dataclasses > than passing a ready namespace The impetus of my running into these issues was assuming that things like `Generic[MyTypeVar]` would "just work" with

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

2018-03-30 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: > If we're going to call new_class in make_dataclass, then we should change the > signature of make_dataclass to have the new_class parameters. Why? I think we should care about what API/signature is reasonable/typical for dataclasses

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

2018-03-30 Thread Eric V. Smith
Eric V. Smith added the comment: If we're going to call new_class in make_dataclass, then we should change the signature of make_dataclass to have the new_class parameters. -- ___ Python tracker

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

2018-03-30 Thread Rick Teachey
Rick Teachey added the comment: Eric: see also Ivan's comment on Issue 33190, which will factor into the solution to this I think. It seems you can't just pass the `namespace` to the `kwds` argument (as I have done in my solution above). --

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

2018-03-30 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: This is not a bug but an explicit design decision. Generic classes are _static_ typing concept and therefore are not supposed to work freely with _dynamic_ class creation. During discussion of PEP 560 it was decided that there should

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

2018-03-30 Thread Rick Teachey
Rick Teachey added the comment: Same error on 3.7. Probably getting beyond my knowledge here but from the error message, it seems like the answer is simply that: type('MyChild', (MyParent[int],), {}) ...is just the wrong way to make a new `type` when utilizing type

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

2018-03-30 Thread Eric V. Smith
Eric V. Smith 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',

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

2018-03-30 Thread Rick Teachey
Rick Teachey added the comment: Sorry: to be clear, the error only occurs when attempting to create the class using `make_dataclass`. -- ___ Python tracker

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

2018-03-30 Thread Rick Teachey
New submission from Rick Teachey : 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