diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-07 20:24:35 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-07 20:24:35 (GMT) |
commit | 0ea51b18d547e555ffa99df60341431b6b85c0a9 (patch) | |
tree | b25a6d575525165d6a325269100b77df91c72fea /Objects/typeobject.c | |
parent | 58ab4b57da2e5db7ff9b9940dd21bbbe4d804957 (diff) | |
download | cpython-0ea51b18d547e555ffa99df60341431b6b85c0a9.zip cpython-0ea51b18d547e555ffa99df60341431b6b85c0a9.tar.gz cpython-0ea51b18d547e555ffa99df60341431b6b85c0a9.tar.bz2 |
Issue #18287: PyType_Ready() now checks that tp_name is not NULL.
Original patch by Niklas Koep.
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r-- | Objects/typeobject.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 950835c..f6d4663 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4066,6 +4066,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) { |