check for NULL to fix segfault

This commit is contained in:
Benjamin Peterson 2012-02-19 20:36:12 -05:00
parent 23d7f12ffb
commit 006c5a2235
1 changed files with 1 additions and 1 deletions

View File

@ -1807,7 +1807,7 @@ subtype_setdict(PyObject *obj, PyObject *value, void *context)
"This object has no __dict__");
return -1;
}
if (!PyDict_Check(value)) {
if (value != NULL && !PyDict_Check(value)) {
PyErr_Format(PyExc_TypeError,
"__dict__ must be set to a dictionary, "
"not a '%.200s'", Py_TYPE(value)->tp_name);