From: Armin Rigo Date: Thu, 19 Apr 2007 14:56:48 +0000 (+0000) Subject: Fix a usage of the dangerous pattern decref - modify field - incref. X-Git-Tag: v2.6a1~1828 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=796fc992ce99fc581d635bea6bdf7f7efeb3c477;p=python Fix a usage of the dangerous pattern decref - modify field - incref. --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a3b1476a8d..89d2d4f981 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -265,9 +265,10 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context) PyObject* mro; PyArg_UnpackTuple(PyList_GET_ITEM(temp, i), "", 2, 2, &cls, &mro); - Py_DECREF(cls->tp_mro); + Py_INCREF(mro); + ob = cls->tp_mro; cls->tp_mro = mro; - Py_INCREF(cls->tp_mro); + Py_DECREF(ob); } Py_DECREF(temp); goto bail;