Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2777d3

Browse files
committed
Changed builtin_sum to use PyNumber_InPlaceAdd (same semantics, but fixes
a performance bug in sum(manylists)), same as in 2.3 maintenance branch.
1 parent 5cf6394 commit a2777d3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Python/bltinmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1840,7 +1840,7 @@ builtin_sum(PyObject *self, PyObject *args)
18401840
}
18411841
break;
18421842
}
1843-
temp = PyNumber_Add(result, item);
1843+
temp = PyNumber_InPlaceAdd(result, item);
18441844
Py_DECREF(result);
18451845
Py_DECREF(item);
18461846
result = temp;

0 commit comments

Comments
 (0)