[issue36178] type.__init__ called instead of cls.__init__ when inheriting from type.

2019-03-04 Thread Hameer Abbasi
Hameer Abbasi added the comment: Ah, I wasn't aware I had to return... The bug was deliberate to show that not even a different signature makes a difference. ;) -- ___ Python tracker

[issue36178] type.__init__ called instead of cls.__init__ when inheriting from type.

2019-03-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: Your metaclass.__new__ method returns None instead of the new class. The rule for calling __init__ is: - if the constructor __new__ returns an instance of the type, then call the initializer __init__ - otherwise, don't call __init__ at all.

[issue36178] type.__init__ called instead of cls.__init__ when inheriting from type.

2019-03-04 Thread Hameer Abbasi
New submission from Hameer Abbasi : I may be completely misunderstanding here, but: here's a reproducible example: class MyMeta(type): def __new__(cls, *args, **kwargs): print('__new__', *args, **kwargs) super().__new__(cls, *args, **kwargs) def __init__(self, a):