diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-10-07 02:36:54 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-10-07 02:36:54 (GMT) |
commit | bd6c41a185ad4a2db9ad693a79496429e2f8d7ee (patch) | |
tree | f5a71ee3153ff4bd6f9c330530d36481cc0bd3d6 /Objects | |
parent | 106ddf07b3e120d79985bab8b6f8ee782c4c7184 (diff) | |
download | cpython-bd6c41a185ad4a2db9ad693a79496429e2f8d7ee.zip cpython-bd6c41a185ad4a2db9ad693a79496429e2f8d7ee.tar.gz cpython-bd6c41a185ad4a2db9ad693a79496429e2f8d7ee.tar.bz2 |
prevent unacceptable bases from becoming bases through multiple inheritance (#24806)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index d39c943..cf4e4e5 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1937,6 +1937,12 @@ best_base(PyObject *bases) if (PyType_Ready(base_i) < 0) return NULL; } + if (!PyType_HasFeature(base_i, Py_TPFLAGS_BASETYPE)) { + PyErr_Format(PyExc_TypeError, + "type '%.100s' is not an acceptable base type", + base_i->tp_name); + return NULL; + } candidate = solid_base(base_i); if (winner == NULL) { winner = candidate; @@ -2317,12 +2323,6 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds) if (base == NULL) { goto error; } - if (!PyType_HasFeature(base, Py_TPFLAGS_BASETYPE)) { - PyErr_Format(PyExc_TypeError, - "type '%.100s' is not an acceptable base type", - base->tp_name); - goto error; - } dict = PyDict_Copy(orig_dict); if (dict == NULL) |