mirror of
https://github.com/python/cpython.git
synced 2025-10-04 06:06:44 +00:00
[3.5] bpo-29532: Altering a kwarg dictionary passed to functools.partial() no longer affects a partial object after creation. (#222)
This commit is contained in:
parent
8fa7e22134
commit
5010a77a4d
3 changed files with 16 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue