[Python-checkins] Update sum comment. (#18240)

Brandt Bucher webhook-mailer at python.org
Sat Feb 1 06:08:39 EST 2020


https://github.com/python/cpython/commit/abb9a448dee3e18c69080231fbeba980bf048211
commit: abb9a448dee3e18c69080231fbeba980bf048211
branch: master
author: Brandt Bucher <brandtbucher at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-02-01T11:08:34Z
summary:

Update sum comment. (#18240)

files:
M Python/bltinmodule.c

diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 4f833c1f46253..5818eb9e38f6a 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);



More information about the Python-checkins mailing list