Files
openide/python/testData/resolve/ResolveAttributesUsingOldStyleMROWhenUnresolvedAncestorsAndC3Fails.py
Andrey Vlasovskikh 19e9c38a86 Fall back to old-style ancestors if C3 MRO fails and there are unresolved ancestors (PY-11401)
If the C3 MRO algorithm fails and the old-style ancestors algorithm
tells that there are unresolved ancestors, we return a single 'null'
ancestor as a sign that we don't know who the ancestors really are.

If there are no unresolved ancestors, then we fall back to the
old-style ancestors algorithm in order to make resolve work. A future
inspection for detecting incorrect MRO may warn the user about this
situation.
2014-12-23 17:14:23 +03:00

24 lines
234 B
Python

class X(Unresolved):
pass
class Y(Unresolved):
pass
class A(X, Y):
def foo(self):
pass
class B(Y, X):
pass
class C(A, B): # we don't know whether MRO is OK or not
pass
print(C.foo)
# <ref>