private void mro_internal() { if (getType() == TYPE) { mro = computeMro(); } else { PyObject mroDescr = getType().lookup("mro"); if (mroDescr == null) { throw Py.AttributeError("mro"); } PyObject[] result = Py.make_array(mroDescr.__get__(null, getType()).__call__(this)); PyType solid = solid_base(this); for (PyObject cls : result) { if (cls instanceof PyClass) { continue; } if (!(cls instanceof PyType)) { throw Py.TypeError(String.format("mro() returned a non-class ('%.500s')", cls.getType().fastGetName())); } PyType t = (PyType)cls; if (!solid.isSubType(solid_base(t))) { throw Py.TypeError(String.format("mro() returned base with unsuitable layout " + "('%.500s')", t.fastGetName())); } } mro = result; } }
throw Py.TypeError("bases must be types"); candidate = solid_base((PyType)base); if (winner == null) { winner = candidate;