Issue 2784: fix leaks in exception exit.

This commit is contained in:
Raymond Hettinger 2008-05-30 06:37:27 +00:00
parent 8df4e22a28
commit 65856600ed
1 changed files with 2 additions and 2 deletions

View File

@ -2305,14 +2305,14 @@ builtin_sum(PyObject *self, PyObject *args)
return PyFloat_FromDouble(f_result); return PyFloat_FromDouble(f_result);
} }
if (PyFloat_CheckExact(item)) { if (PyFloat_CheckExact(item)) {
PyFPE_START_PROTECT("add", return 0) PyFPE_START_PROTECT("add", Py_DECREF(item); Py_DECREF(iter); return 0)
f_result += PyFloat_AS_DOUBLE(item); f_result += PyFloat_AS_DOUBLE(item);
PyFPE_END_PROTECT(f_result) PyFPE_END_PROTECT(f_result)
Py_DECREF(item); Py_DECREF(item);
continue; continue;
} }
if (PyInt_CheckExact(item)) { if (PyInt_CheckExact(item)) {
PyFPE_START_PROTECT("add", return 0) PyFPE_START_PROTECT("add", Py_DECREF(item); Py_DECREF(iter); return 0)
f_result += (double)PyInt_AS_LONG(item); f_result += (double)PyInt_AS_LONG(item);
PyFPE_END_PROTECT(f_result) PyFPE_END_PROTECT(f_result)
Py_DECREF(item); Py_DECREF(item);