Daniel Urban <urban.dani...@gmail.com> added the comment: The attached patch seems to correct this issue. It contains the test attached yesterday, and it passes now.
I factored out the winner calculation from type_new to a new _PyType_CalculateWinner function, and type_new calls this. I've put the declaration of this function into object.h, so __build_class__ can also call it, instead of using the metaclass of the first base. (Am I correct in thinking that the underscore prefix keeps it out of the public API?) A slight problem may be, that in some cases this function will be called twice. But it is quite simple, so I don't think it matters much: Without patch: $ ./python -m timeit -- "class A(type): pass class B: pass class C(metaclass=A): pass class D(B, C): pass " 10000 loops, best of 3: 371 usec per loop With patch: $ ./python -m timeit -- "class A(type): pass class B: pass class C(metaclass=A): pass class D(B, C): pass " 10000 loops, best of 3: 381 usec per loop (Note, that I generated the patch with hg extdiff, because the output of hg qdiff was much more unreadable than simple diff. I can provide an equivalent patch generated by hg if needed.) ---------- Added file: http://bugs.python.org/file21530/issue_1294232.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1294232> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com