]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-35615: Fix crashes when copying a Weak{Key,Value}Dictionary. (GH-11384) (GH-11785)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 7 Feb 2019 20:09:16 +0000 (12:09 -0800)
committerAntoine Pitrou <pitrou@free.fr>
Thu, 7 Feb 2019 20:09:16 +0000 (20:09 +0000)
commit48769a28ad6ef4183508951fa6a378531ace26a4
treeba8873a08906f32f0a3d992f0d0fb3b7dcf556ec
parent15526f5be72f547288c16d53526fc74f15ee61ed
bpo-35615: Fix crashes when copying a Weak{Key,Value}Dictionary. (GH-11384) (GH-11785)

Protect dict iterations by wrapping them with _IterationGuard in the
following methods:

- WeakValueDictionary.copy()
- WeakValueDictionary.__deepcopy__()
- WeakKeyDictionary.copy()
- WeakKeyDictionary.__deepcopy__()
(cherry picked from commit 96d37dbcd23e65a7a57819aeced9034296ef747e)

Co-authored-by: Fish <ltfish@users.noreply.github.com>
Lib/test/test_weakref.py
Lib/weakref.py
Misc/NEWS.d/next/Library/2018-12-30-20-00-05.bpo-35615.Uz1SVh.rst [new file with mode: 0644]