Merge 3.6 (fix #29519)
This commit is contained in:
commit
40ee824d1d
|
@ -106,7 +106,7 @@ class WeakValueDictionary(collections.MutableMapping):
|
||||||
self, *args = args
|
self, *args = args
|
||||||
if len(args) > 1:
|
if len(args) > 1:
|
||||||
raise TypeError('expected at most 1 arguments, got %d' % len(args))
|
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()
|
self = selfref()
|
||||||
if self is not None:
|
if self is not None:
|
||||||
if self._iterating:
|
if self._iterating:
|
||||||
|
@ -114,7 +114,7 @@ class WeakValueDictionary(collections.MutableMapping):
|
||||||
else:
|
else:
|
||||||
# Atomic removal is necessary since this function
|
# Atomic removal is necessary since this function
|
||||||
# can be called asynchronously by the GC
|
# can be called asynchronously by the GC
|
||||||
_remove_dead_weakref(d, wr.key)
|
_atomic_removal(d, wr.key)
|
||||||
self._remove = remove
|
self._remove = remove
|
||||||
# A list of keys to be removed
|
# A list of keys to be removed
|
||||||
self._pending_removals = []
|
self._pending_removals = []
|
||||||
|
|
Loading…
Reference in New Issue