subclass __module__ set to metaclass module when manually creating new class with type()
In the following example, the newly created subclass ends up being the metaclass __module__ rather than the parent classes' module. I've only seen this happen when using ABCMeta so it could be something specific to that module, anyone know what might be happening? In [1]: from abc import ABCMeta In [2]: class test(metaclass=ABCMeta): ...: pass ...: In [3]: newclass = type('newclass', (test,), {}) In [4]: newclass.__module__ Out[4]: 'abc' The behavior I want happens when I define the subclass in the more standard way: In [5]: class subtest(test): ...: pass ...: In [6]: subtest.__module__ Out[6]