summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2007-04-19 14:56:48 (GMT)
committerArmin Rigo <arigo@tunes.org>2007-04-19 14:56:48 (GMT)
commit796fc992ce99fc581d635bea6bdf7f7efeb3c477 (patch)
tree54ca6bf8067dd1b8620a89f82340d9085ce25bc2
parentc0ba52d3fd6a4d6211d5a1a4ffe96f1b96fffd74 (diff)
downloadcpython-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.c5
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;