Nick Coghlan added the comment:
I think we should actually go further, and explicitly defer to
http://docs.python.org/3/library/types#dynamic-type-creation for dynamic type
creation.
Type shouldn't be called with arbitrary bases any more, precisely *because*
doing so breaks __prepare__ handling. It's only safe to call a metaclass
directly with arbitrary bases if you call types.prepare_class first:
mcl, namespace, kwds = types.prepare_class(name, bases)
cls = mcl(name, bases, namespace, **kwds)
You can only skip types.prepare_class if you *know* you already have the right
metaclass (such as when there aren't any base classes defined).
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18334>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com