summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index ce1d42b..877bcb7 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2530,6 +2530,13 @@ type_getattro(PyTypeObject *type, PyObject *name)
PyObject *meta_attribute, *attribute;
descrgetfunc meta_get;
+ if (!PyString_Check(name)) {
+ PyErr_Format(PyExc_TypeError,
+ "attribute name must be string, not '%.200s'",
+ name->ob_type->tp_name);
+ return NULL;
+ }
+
/* Initialize this type (we'll assume the metatype is initialized) */
if (type->tp_dict == NULL) {
if (PyType_Ready(type) < 0)