Issue #18287: PyType_Ready() now checks that tp_name is not NULL.

Original patch by Niklas Koep.
This commit is contained in:
Serhiy Storchaka 2016-10-07 23:25:46 +03:00
commit e45b7c09ec
5 changed files with 15 additions and 2 deletions

View file

@ -4893,6 +4893,12 @@ PyType_Ready(PyTypeObject *type)
_Py_AddToAllObjects((PyObject *)type, 0);
#endif
if (type->tp_name == NULL) {
PyErr_Format(PyExc_SystemError,
"Type does not define the tp_name field.");
goto error;
}
/* Initialize tp_base (defaults to BaseObject unless that's us) */
base = type->tp_base;
if (base == NULL && type != &PyBaseObject_Type) {