diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2017-07-31 17:52:46 (GMT) |
---|---|---|
committer | Ćukasz Langa <lukasz@langa.pl> | 2017-07-31 17:52:46 (GMT) |
commit | 3e37f4a11547a226c3c2f8bd612510465db397b9 (patch) | |
tree | 639ff99f769fce14e24abad406f222e747ff1946 /Lib | |
parent | fa90179e071668c431e725a29f8c88d8d25ec887 (diff) | |
download | cpython-3e37f4a11547a226c3c2f8bd612510465db397b9.zip cpython-3e37f4a11547a226c3c2f8bd612510465db397b9.tar.gz cpython-3e37f4a11547a226c3c2f8bd612510465db397b9.tar.bz2 |
bpo-29519: weakref spewing exceptions during interp finalization (#2958)
(cherry pick from 9cd7e17640a49635d1c1f8c2989578a8fc2c1de6)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/weakref.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/weakref.py b/Lib/weakref.py index c66943f..3e1fb81 100644 --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -53,7 +53,7 @@ class WeakValueDictionary(UserDict.UserDict): args = args[1:] if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) - def remove(wr, selfref=ref(self)): + def remove(wr, selfref=ref(self), _atomic_removal=_remove_dead_weakref): self = selfref() if self is not None: if self._iterating: @@ -61,7 +61,7 @@ class WeakValueDictionary(UserDict.UserDict): else: # Atomic removal is necessary since this function # can be called asynchronously by the GC - _remove_dead_weakref(self.data, wr.key) + _atomic_removal(self.data, wr.key) self._remove = remove # A list of keys to be removed self._pending_removals = [] |