[issue32162] typing.Generic breaks __init_subclass__

2018-04-02 Thread Will T
Will T added the comment: Done: https://bugs.python.org/issue33207 - thanks for the quick response! -- ___ Python tracker ___

[issue32162] typing.Generic breaks __init_subclass__

2018-04-02 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Thanks Will! I think this is actually a different (although very similar issue). It looks like it is easy to fix. Could you please open a separate issue (and mention it here)? Also could you please provide a typical example when this

[issue32162] typing.Generic breaks __init_subclass__

2018-04-02 Thread Will T
Will T added the comment: I believe I'm experiencing a related bug in the new (3.7) version unfortunately. The current version of typing.Generic.__init_subclass__ isn't chaining to super(Generic, cls).__init_subclass__, meaning Generic's position in class bases can

[issue32162] typing.Generic breaks __init_subclass__

2018-02-18 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: FWIW, this is fixed in 3.7 by PEP 560, providing a separate fix for 3.6 is not easy, and you have a good workaround, so I propose to close this issue. -- resolution: -> fixed stage: -> resolved status: open -> closed

[issue32162] typing.Generic breaks __init_subclass__

2017-12-01 Thread Ivan Levkivskyi
Change by Ivan Levkivskyi : -- nosy: +levkivskyi ___ Python tracker ___ ___

[issue32162] typing.Generic breaks __init_subclass__

2017-11-28 Thread Ilya Kulakov
Ilya Kulakov added the comment: That's a better workaround: class X(typing.Generic[T]): def __init_subclass__(cls, **kwargs): super(typing.GenericMeta, cls).__setattr__('_gorg', cls) super().__init_subclass__(**kwargs) --

[issue32162] typing.Generic breaks __init_subclass__

2017-11-28 Thread Ilya Kulakov
Ilya Kulakov added the comment: Nah, that's a bad one: you cannot use Generic classes as intended by specifying types. It looks like it happens because cls._grog is not yet set properly by the time __init_subclass__ is called. --

[issue32162] typing.Generic breaks __init_subclass__

2017-11-28 Thread Ilya Kulakov
Ilya Kulakov added the comment: Current workaround is class X(typing.Generic[T] if typing.TYPE_CHECKING else object): -- ___ Python tracker

[issue32162] typing.Generic breaks __init_subclass__

2017-11-28 Thread Ilya Kulakov
Ilya Kulakov added the comment: This issue is more server that I expected: it doesn't just propagate value to superclasses, but overrides them. The last subclass created by Python runtime will overwrite value for the whole chain. --

[issue32162] typing.Generic breaks __init_subclass__

2017-11-28 Thread Ilya Kulakov
New submission from Ilya Kulakov : When superclass inherits from Generic, attributes set for a subclass are incorrectly propagated to its superclass. Without Generic attribute access raises an exception: class X: def __init_subclass__(cls, **kwargs):