mirror of https://github.com/python/cpython
Issue 2784: fix leaks in exception exit.
This commit is contained in:
parent
8df4e22a28
commit
65856600ed
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue