Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Replace duplicate Py_TPFLAGS_BASETYPE check with an assert
  • Loading branch information
encukou committed Jun 9, 2022
commit 6b31880cf77b079386844e9d3a43cdcc712d3264
9 changes: 3 additions & 6 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3485,12 +3485,9 @@ PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module,
if (base == NULL) {
goto finally;
}
if (!_PyType_HasFeature(base, Py_TPFLAGS_BASETYPE)) {
PyErr_Format(PyExc_TypeError,
"type '%.100s' is not an acceptable base type",
base->tp_name);
goto finally;
}
// best_base should check Py_TPFLAGS_BASETYPE & raise a proper exception,
// here we just check its work
assert(_PyType_HasFeature(base, Py_TPFLAGS_BASETYPE));

/* Allocate the new type */

Expand Down