diff options
author | Armin Rigo <arigo@tunes.org> | 2007-04-19 14:56:48 (GMT) |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2007-04-19 14:56:48 (GMT) |
commit | 796fc992ce99fc581d635bea6bdf7f7efeb3c477 (patch) | |
tree | 54ca6bf8067dd1b8620a89f82340d9085ce25bc2 | |
parent | c0ba52d3fd6a4d6211d5a1a4ffe96f1b96fffd74 (diff) | |
download | cpython-796fc992ce99fc581d635bea6bdf7f7efeb3c477.zip cpython-796fc992ce99fc581d635bea6bdf7f7efeb3c477.tar.gz cpython-796fc992ce99fc581d635bea6bdf7f7efeb3c477.tar.bz2 |
Fix a usage of the dangerous pattern decref - modify field - incref.
-rw-r--r-- | Objects/typeobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a3b1476..89d2d4f 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; |