summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-02-22 09:46:32 (GMT)
committerGitHub <noreply@github.com>2017-02-22 09:46:32 (GMT)
commit5010a77a4da76d8d3fd861a63a7f1ce8f0e9c520 (patch)
tree4d2bc1177ae8ee62768774567684506c7a392681 /Lib/test
parent8fa7e22134ac9626b2188ff877f6aeecd3c9e618 (diff)
downloadcpython-5010a77a4da76d8d3fd861a63a7f1ce8f0e9c520.zip
cpython-5010a77a4da76d8d3fd861a63a7f1ce8f0e9c520.tar.gz
cpython-5010a77a4da76d8d3fd861a63a7f1ce8f0e9c520.tar.bz2
[3.5] bpo-29532: Altering a kwarg dictionary passed to functools.partial() no longer affects a partial object after creation. (#222)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_functools.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index 9ccd0ca..a82ca7a 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -80,6 +80,15 @@ class TestPartial:
p(b=7)
self.assertEqual(d, {'a':3})
+ def test_kwargs_copy(self):
+ # Issue #29532: Altering a kwarg dictionary passed to a constructor
+ # should not affect a partial object after creation
+ d = {'a': 3}
+ p = self.partial(capture, **d)
+ self.assertEqual(p(), ((), {'a': 3}))
+ d['a'] = 5
+ self.assertEqual(p(), ((), {'a': 3}))
+
def test_arg_combinations(self):
# exercise special code paths for zero args in either partial
# object or the caller