summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2007-10-24 02:05:51 (GMT)
committerRaymond Hettinger <python@rcn.com>2007-10-24 02:05:51 (GMT)
commit3a8daf5b56fc6c298c30536583a5b903f9a31fb3 (patch)
tree951618b9fcbdbd882d7aa570931348b70ffbfc7b /Python/bltinmodule.c
parent3f8caa3ba733619e466d1b829acecefd35684345 (diff)
downloadcpython-3a8daf5b56fc6c298c30536583a5b903f9a31fb3.zip
cpython-3a8daf5b56fc6c298c30536583a5b903f9a31fb3.tar.gz
cpython-3a8daf5b56fc6c298c30536583a5b903f9a31fb3.tar.bz2
Fixup error return and add support for intermixed ints and floats/
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index cc96cdf..7d5de27 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -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);