[Python-checkins] r72960 - in python/branches/py3k: Objects/dictobject.c

benjamin.peterson python-checkins at python.org
Wed May 27 05:18:39 CEST 2009


Author: benjamin.peterson
Date: Wed May 27 05:18:19 2009
New Revision: 72960

Log:
Merged revisions 72958 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72958 | benjamin.peterson | 2009-05-26 22:08:44 -0500 (Tue, 26 May 2009) | 1 line
  
  plug ref leak
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Objects/dictobject.c

Modified: python/branches/py3k/Objects/dictobject.c
==============================================================================
--- python/branches/py3k/Objects/dictobject.c	(original)
+++ python/branches/py3k/Objects/dictobject.c	Wed May 27 05:18:19 2009
@@ -1126,14 +1126,17 @@
 	if (v == NULL) {
 		if (!PyDict_CheckExact(mp)) {
 			/* Look up __missing__ method if we're a subclass. */
-		    	PyObject *missing;
+		    	PyObject *missing, *res;
 			static PyObject *missing_str = NULL;
 			missing = _PyObject_LookupSpecial((PyObject *)mp,
 							  "__missing__",
 							  &missing_str);
-			if (missing != NULL)
-				return PyObject_CallFunctionObjArgs(missing,
-					key, NULL);
+			if (missing != NULL) {
+				res = PyObject_CallFunctionObjArgs(missing,
+								   key, NULL);
+				Py_DECREF(missing);
+				return res;
+			}
 			else if (PyErr_Occurred())
 				return NULL;
 		}


More information about the Python-checkins mailing list