mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #18287: PyType_Ready() now checks that tp_name is not NULL.
Original patch by Niklas Koep.
This commit is contained in:
commit
e45b7c09ec
5 changed files with 15 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue