summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-10-07 23:25:46 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2016-10-07 23:25:46 +0300
commite45b7c09ece01c9b35a14b89eb64e1324ed321a8 (patch)
treed64a23ff36d35c76ad881b61ed08e644c0c82dbe /Objects
parent242c170f878cc38eb32b26b55f69a9d7cef947a7 (diff)
parentde0574bdabc1183706406b421dea2e3e3c165eb3 (diff)
downloadcpython-git-e45b7c09ece01c9b35a14b89eb64e1324ed321a8.tar.gz
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.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index cb251ddfb8..52d5982a75 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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) {