mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Fixup error return and add support for intermixed ints and floats/
This commit is contained in:
parent
3f8caa3ba7
commit
3a8daf5b56
1 changed files with 7 additions and 1 deletions
|
@ -2120,7 +2120,13 @@ builtin_sum(PyObject *self, PyObject *args)
|
|||
if (PyFloat_CheckExact(item)) {
|
||||
PyFPE_START_PROTECT("add", return 0)
|
||||
f_result += PyFloat_AS_DOUBLE(item);
|
||||
PyFPE_END_PROTECT(a)
|
||||
PyFPE_END_PROTECT(f_result)
|
||||
continue;
|
||||
}
|
||||
if (PyInt_CheckExact(item)) {
|
||||
PyFPE_START_PROTECT("add", return 0)
|
||||
f_result += (double)PyInt_AS_LONG(item);
|
||||
PyFPE_END_PROTECT(f_result)
|
||||
continue;
|
||||
}
|
||||
result = PyFloat_FromDouble(f_result);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue