Issue 699934: Obscure error message (original) (raw)

Created on 2003-03-08 12:29 by bpettersen, last changed 2022-04-10 16:07 by admin. This issue is now closed.

Messages (9)
msg15036 - (view) Author: Bjorn Pettersen (bpettersen) Date: 2003-03-08 12:29
>>> class A(object): ... m = 1 ... >>> class B(A): pass ... >>> class C(A): pass ... >>> class D(A,B): pass ... Traceback (most recent call last): File "", line 1, in ? TypeError: MRO conflict among bases A, B I happen to know what MRO stands for, but probably most people that made the typo I did in the diamond inheritance graph will have no idea what they did wrong... How about "One of the declared superclasses A, B inherits from the other, the method resolution order (MRO) would therefore be undefined. Cannot create class." -- bjorn
msg15037 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-03-12 01:29
Logged In: YES user_id=80475 I don't think the first part of the sentence is accurate. MRO conflicts can arise for less straight-forward reasons. How about: "Cannot create class. Superclasses A, B have conflicting inheritance trees which leave the method resolution order (MRO) undefined."
msg15038 - (view) Author: Bjorn Pettersen (bpettersen) Date: 2003-03-12 02:50
Logged In: YES user_id=556638 Even better. If I were to suggest anything, it would be to add "(lookup)" after "resolution" since that seems to be the more frequently used terminology -- not a big issue though.
msg15039 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-03-12 04:38
Logged In: YES user_id=80475 Fixed. See: Objects/typeobject.c 2.216 Lib/test/test_descr.py 1.187
msg15040 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2003-03-12 13:01
Logged In: YES user_id=6656 Unfortunately the new error message makes no sense when you get it by rearranging __bases__.
msg15041 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-03-14 06:34
Logged In: YES user_id=80475 Idea 1 ------ TypeError: Cannot create class. Accessing superclasses A, B in order creates conflicting inheritance trees which leave the method resolution order (MRO) undefined. Idea 2 ------ Cannot create a consistent method resolution order (MRO) for bases A, B. Idea 3 ------ Doh!
msg15042 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-04-06 10:10
Logged In: YES user_id=80475 Michael, do you have a preference?
msg15043 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2003-04-06 13:35
Logged In: YES user_id=6656 I'd say "idea 2". the issues too complicated to have a hope of explaining in the error message, so the only hope is to hand out enough key words to make finding the relavent section of the docs easy. I'd also like to say: The "of course, while I have no problem with this at all, it's surely too much for a lesser being" flavor of argument always rings hollow to me. -- Tim Peters, 29 Apr 1998
msg15044 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-04-06 19:30
Logged In: YES user_id=80475 Fixed.
History
Date User Action Args
2022-04-10 16:07:30 admin set github: 38129
2003-03-08 12:29:13 bpettersen create