From 796fc992ce99fc581d635bea6bdf7f7efeb3c477 Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Thu, 19 Apr 2007 14:56:48 +0000 Subject: [PATCH] Fix a usage of the dangerous pattern decref - modify field - incref. --- Objects/typeobject.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a3b1476a8d5..89d2d4f9813 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;