]> granicus.if.org Git - python/commitdiff
Added notimplemented_dealloc for better error reporting
authorArmin Ronacher <armin.ronacher@active-4.com>
Sat, 6 Oct 2012 12:28:58 +0000 (14:28 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Sat, 6 Oct 2012 12:28:58 +0000 (14:28 +0200)
Objects/object.c

index f41718424d83392879d8b05d887769cb5b5774ef..858eebedf09600d073a351d8e733220d23ef15d9 100644 (file)
@@ -1524,12 +1524,21 @@ notimplemented_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     Py_RETURN_NOTIMPLEMENTED;
 }
 
+static void
+notimplemented_dealloc(PyObject* ignore)
+{
+    /* This should never get called, but we also don't want to SEGV if
+     * we accidentally decref NotImplemented out of existence.
+     */
+    Py_FatalError("deallocating NotImplemented");
+}
+
 static PyTypeObject PyNotImplemented_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "NotImplementedType",
     0,
     0,
-    none_dealloc,       /*tp_dealloc*/ /*never called*/
+    notimplemented_dealloc,       /*tp_dealloc*/ /*never called*/
     0,                  /*tp_print*/
     0,                  /*tp_getattr*/
     0,                  /*tp_setattr*/