From: Benjamin Peterson Date: Mon, 20 Feb 2012 01:36:12 +0000 (-0500) Subject: check for NULL to fix segfault X-Git-Tag: v3.3.0a1~128 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=006c5a22354ea73ee26163a957782115cef25f8f;p=python check for NULL to fix segfault --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a5abcce4a0..9aa752e057 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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);