Message134055
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. |
|
Date |
User |
Action |
Args |
2011-04-19 14:03:33 | ncoghlan | set | recipients:
+ ncoghlan, gvanrossum, georg.brandl, terry.reedy, amaury.forgeotdarc, rodsenra, pwerneck, benjamin.peterson, daniel.urban |
2011-04-19 14:03:33 | ncoghlan | set | messageid: <1303221813.58.0.772209328973.issue1294232@psf.upfronthosting.co.za> |
2011-04-19 14:03:33 | ncoghlan | link | issue1294232 messages |
2011-04-19 14:03:32 | ncoghlan | create | |
|