From: Brandt Bucher Date: Sat, 1 Feb 2020 11:08:34 +0000 (-0800) Subject: Update sum comment. (#18240) X-Git-Tag: v3.9.0a4~159 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=abb9a448dee3e18c69080231fbeba980bf048211;p=thirdparty%2FPython%2Fcpython.git Update sum comment. (#18240) --- diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 4f833c1f4625..5818eb9e38f6 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2440,7 +2440,11 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start) empty = [] sum([[x] for x in range(10)], empty) - would change the value of empty. */ + would change the value of empty. In fact, using + in-place addition rather that binary addition for + any of the steps introduces subtle behavior changes: + + https://bugs.python.org/issue18305 */ temp = PyNumber_Add(result, item); Py_DECREF(result); Py_DECREF(item);