mirror of https://github.com/python/cpython
merge 3.2
This commit is contained in:
commit
9ee601e197
|
@ -490,26 +490,22 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context)
|
||||||
for (i = 0; i < PyTuple_GET_SIZE(value); i++) {
|
for (i = 0; i < PyTuple_GET_SIZE(value); i++) {
|
||||||
ob = PyTuple_GET_ITEM(value, i);
|
ob = PyTuple_GET_ITEM(value, i);
|
||||||
if (!PyType_Check(ob)) {
|
if (!PyType_Check(ob)) {
|
||||||
PyErr_Format(
|
PyErr_Format(PyExc_TypeError,
|
||||||
PyExc_TypeError,
|
|
||||||
"%s.__bases__ must be tuple of classes, not '%s'",
|
"%s.__bases__ must be tuple of classes, not '%s'",
|
||||||
type->tp_name, Py_TYPE(ob)->tp_name);
|
type->tp_name, Py_TYPE(ob)->tp_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (PyType_Check(ob)) {
|
|
||||||
if (PyType_IsSubtype((PyTypeObject*)ob, type)) {
|
if (PyType_IsSubtype((PyTypeObject*)ob, type)) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"a __bases__ item causes an inheritance cycle");
|
"a __bases__ item causes an inheritance cycle");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
new_base = best_base(value);
|
new_base = best_base(value);
|
||||||
|
|
||||||
if (!new_base) {
|
if (!new_base)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
if (!compatible_for_assignment(type->tp_base, new_base, "__bases__"))
|
if (!compatible_for_assignment(type->tp_base, new_base, "__bases__"))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue