[Python-checkins] r54876 - python/trunk/Objects/typeobject.c

armin.rigo python-checkins at python.org
Thu Apr 19 16:56:56 CEST 2007


Author: armin.rigo
Date: Thu Apr 19 16:56:48 2007
New Revision: 54876

Modified:
   python/trunk/Objects/typeobject.c
Log:
Fix a usage of the dangerous pattern decref - modify field - incref.


Modified: python/trunk/Objects/typeobject.c
==============================================================================
--- python/trunk/Objects/typeobject.c	(original)
+++ python/trunk/Objects/typeobject.c	Thu Apr 19 16:56:48 2007
@@ -265,9 +265,10 @@
 			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;


More information about the Python-checkins mailing list