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 | de0574bdabc1183706406b421dea2e3e3c165eb3 (patch) | |
tree | 64b0977a9369569ad93d106940262a629938e934 /Objects | |
parent | 8793b215253bf69cc699fab77b12d7f1313360d8 (diff) | |
download | cpython-de0574bdabc1183706406b421dea2e3e3c165eb3.zip cpython-de0574bdabc1183706406b421dea2e3e3c165eb3.tar.gz cpython-de0574bdabc1183706406b421dea2e3e3c165eb3.tar.bz2 |
Issue #18287: PyType_Ready() now checks that tp_name is not NULL.
Original patch by Niklas Koep.
Diffstat (limited to 'Objects')
-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 e71b3f8..cbffecd 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4820,6 +4820,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) { |