[Python-checkins] cpython: Fix some of the remaining test_capi refleaks

antoine.pitrou python-checkins at python.org
Wed Jan 18 21:49:01 CET 2012


http://hg.python.org/cpython/rev/29a28018e567
changeset:   74508:29a28018e567
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Jan 18 21:29:05 2012 +0100
summary:
  Fix some of the remaining test_capi refleaks

files:
  Objects/exceptions.c |  2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/Objects/exceptions.c b/Objects/exceptions.c
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -2225,6 +2225,7 @@
         Py_FatalError("Module dictionary insertion problem.");
 
 #define INIT_ALIAS(NAME, TYPE) Py_INCREF(PyExc_ ## TYPE); \
+    Py_XDECREF(PyExc_ ## NAME); \
     PyExc_ ## NAME = PyExc_ ## TYPE; \
     if (PyDict_SetItemString(bdict, # NAME, PyExc_ ## NAME)) \
         Py_FatalError("Module dictionary insertion problem.");
@@ -2234,6 +2235,7 @@
     assert(_PyObject_RealIsSubclass(PyExc_ ## TYPE, PyExc_OSError)); \
     if (!_code || PyDict_SetItem(errnomap, _code, PyExc_ ## TYPE)) \
         Py_FatalError("errmap insertion problem."); \
+    Py_DECREF(_code); \
     }
 
 #ifdef MS_WINDOWS

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list