Mercurial > cpython-lru_cache-weakref
diff Objects/typeobject.c @ 75740:d1cf6008a565 2.7
check to make sure the attribute is a string (#14334)
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Fri, 16 Mar 2012 09:32:59 -0500 |
| parents | c7623da4e2af |
| children | e3eda2d91e93 |
line wrap: on
line diff
--- a/Objects/typeobject.c Fri Mar 16 01:07:16 2012 -0700 +++ b/Objects/typeobject.c Fri Mar 16 09:32:59 2012 -0500 @@ -2530,6 +2530,13 @@ 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)
