summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_functools.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-02-20 12:04:30 (GMT)
committerGitHub <noreply@github.com>2017-02-20 12:04:30 (GMT)
commit9639e4ab6d5bd3ca0ab34fef127e9fc84b6b88b9 (patch)
tree9a4b96861524f2c043b8409fae6cf11300f2d412 /Lib/test/test_functools.py
parentd0e8212ed70445cc3d48b0d4ae7c9cb480004010 (diff)
downloadcpython-9639e4ab6d5bd3ca0ab34fef127e9fc84b6b88b9.zip
cpython-9639e4ab6d5bd3ca0ab34fef127e9fc84b6b88b9.tar.gz
cpython-9639e4ab6d5bd3ca0ab34fef127e9fc84b6b88b9.tar.bz2
bpo-29532: Altering a kwarg dictionary passed to functools.partial() (#190)
no longer affects a partial object after creation.
Diffstat (limited to 'Lib/test/test_functools.py')
-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 63fe83e..612ca17 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -90,6 +90,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