Add a comment to prevent further attempts to avoid a copy for
optimization.
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);
if (nk != 0) {
Py_ssize_t pos, i;
- /* Issue #29318: Caller and callee functions must not share the
- dictionary: kwargs must be copied. */
+ /* bpo-29318, bpo-27840: Caller and callee functions must not share
+ the dictionary: kwargs must be copied. */
kwtuple = PyTuple_New(2 * nk);
if (kwtuple == NULL) {
return NULL;