]> granicus.if.org Git - python/commitdiff
check for NULL to fix segfault
authorBenjamin Peterson <benjamin@python.org>
Mon, 20 Feb 2012 01:36:12 +0000 (20:36 -0500)
committerBenjamin Peterson <benjamin@python.org>
Mon, 20 Feb 2012 01:36:12 +0000 (20:36 -0500)
Objects/typeobject.c

index a5abcce4a0872264bfd5346354c15661fc24c785..9aa752e057305f7aa6b8b2ace23632f122ae7036 100644 (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);