New submission from Edward Catmur: Suppose we have a class C with MRO (C, B, A, object). C virtual-inherits an ABC V, while B virtual-inherits an unrelated ABC W:
object / | \ A W | | .` / B` V | .` C` Recalling that per PEP 443 singledispatch prefers concrete bases to virtual bases, we would expect the following composed MRO: C, B, V, A, W, object However what actually happens is the composed MRO depends on the order of the haystack; if W is processed first the result is correct, but if V is processed first then (because V does not subclass W) W is inserted in the MRO *before* V: C, B, A, object C, B, V, A, object C, B, W, V, A, object This results in ambiguity between V and W. Suggested fix is a slight change to the MRO composition algorithm, considering whether the items already placed in the MRO are concrete base classes. ---------- components: Extension Modules hgrepos: 200 messages: 191350 nosy: ecatmur priority: normal severity: normal status: open title: singledispatch: When virtual-inheriting ABCs at distinct points in MRO, composed MRO is dependent on haystack ordering versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18244> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com