Fix a usage of the dangerous pattern decref - modify field - incref.

This commit is contained in:
Armin Rigo 2007-04-19 14:56:48 +00:00
parent c0ba52d3fd
commit 796fc992ce
1 changed files with 3 additions and 2 deletions

View File

@ -265,9 +265,10 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context)
PyObject* mro; PyObject* mro;
PyArg_UnpackTuple(PyList_GET_ITEM(temp, i), PyArg_UnpackTuple(PyList_GET_ITEM(temp, i),
"", 2, 2, &cls, &mro); "", 2, 2, &cls, &mro);
Py_DECREF(cls->tp_mro); Py_INCREF(mro);
ob = cls->tp_mro;
cls->tp_mro = mro; cls->tp_mro = mro;
Py_INCREF(cls->tp_mro); Py_DECREF(ob);
} }
Py_DECREF(temp); Py_DECREF(temp);
goto bail; goto bail;