summaryrefslogtreecommitdiffstats
path: root/Modules/_functoolsmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-02-23 17:26:43 (GMT)
committerGitHub <noreply@github.com>2017-02-23 17:26:43 (GMT)
commit561ca80cffd37445bac82ff820b8f52b98c50517 (patch)
tree54cb4548eb710ebda5e6cc5e896ef1f9ac2dc3ad /Modules/_functoolsmodule.c
parent324c5d8ca6ed1c964d3b20e5762139ec65c7827c (diff)
downloadcpython-561ca80cffd37445bac82ff820b8f52b98c50517.zip
cpython-561ca80cffd37445bac82ff820b8f52b98c50517.tar.gz
cpython-561ca80cffd37445bac82ff820b8f52b98c50517.tar.bz2
Document why functools.partial() must copy kwargs (#253)
Add a comment to prevent further attempts to avoid a copy for optimization.
Diffstat (limited to 'Modules/_functoolsmodule.c')
-rw-r--r--Modules/_functoolsmodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index c856505..dcaa99f 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -163,6 +163,9 @@ partial_call(partialobject *pto, PyObject *args, PyObject *kw)
Py_XINCREF(kwappl);
}
else {
+ /* bpo-27840, bpo-29318: dictionary of keyword parameters must be
+ copied, because a function using "**kwargs" can modify the
+ dictionary. */
kwappl = PyDict_Copy(pto->kw);
if (kwappl == NULL) {
Py_XDECREF(argappl);