[Python-checkins] cpython: check for NULL to fix segfault

benjamin.peterson python-checkins at python.org
Mon Feb 20 02:36:17 CET 2012


http://hg.python.org/cpython/rev/857cc070ef75
changeset:   75054:857cc070ef75
parent:      75051:f029312764b4
user:        Benjamin Peterson <benjamin at python.org>
date:        Sun Feb 19 20:36:12 2012 -0500
summary:
  check for NULL to fix segfault

files:
  Objects/typeobject.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1807,7 +1807,7 @@
                         "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);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list