Message134055
| Author |
ncoghlan |
| Recipients |
amaury.forgeotdarc, benjamin.peterson, daniel.urban, georg.brandl, gvanrossum, ncoghlan, pwerneck, rodsenra, terry.reedy |
| Date |
2011年04月19日.14:03:32 |
| SpamBayes Score |
2.6090857e-10 |
| Marked as misclassified |
No |
| Message-id |
<1303221813.58.0.772209328973.issue1294232@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Sorry, my last review wasn't right and the patch is incorrect as it stands. After digging a little deeper, there is still a case that isn't covered correctly in __build_class__.
Specifically, the case where the most derived class has a declared metatype that is the *parent* of the metaclass that *should* be used.
This can be seen in type_new, where it does the "if (winner != metatype)" check. There is no equivalent check in __build_class__ - instead, the explicitly declared metaclass always wins.
What needs to happen is that the call to _PyType_CalculateMetaclass in __build_class__ should be moved out so that it is unconditional. The passed in metatype will either by the explicitly declared one (if it exists) or else PyType_Type. An additional test to pick up this case is also needed. |
|