[issue1294232] Error in metaclass search order

Nick Coghlan report at bugs.python.org
Thu Apr 21 16:11:30 CEST 2011


Nick Coghlan <ncoghlan at gmail.com> added the comment:

I think PEP 3115 is OK - the error about all metaclasses inheriting from type was a mistake on my part (I thought the ability to create non-type metaclasses went away along with old-style classes, but I was simply wrong on that point).

That got me curious as to how the explicit inheritance from object + explicit non-type metaclass case was working in 2.7, and it turns out it *does* share the same initial metaclass determination error as 3.x - it is just that build_class() is embedded in ceval.c rather than being published as a builtin.

So I have two conclusions:

- to match existing behaviour when __metaclass__ is not an instance of type(), __build_class__ still needs one special case where it bypasses the normal metaclass calculation: when an explicit metaclass exists and is *not* an instance of type.

- after we get 3.x sorted, we will want to backport this to the ceval version of build_class() in 2.7

----------
versions: +Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1294232>
_______________________________________


More information about the Python-bugs-list mailing list