summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorŁukasz Langa <lukasz@langa.pl>2017-02-10 08:14:55 (GMT)
committerŁukasz Langa <lukasz@langa.pl>2017-02-10 08:14:55 (GMT)
commit9cd7e17640a49635d1c1f8c2989578a8fc2c1de6 (patch)
tree23bb3890a0c4aedcac6b85121fc91b59b2c55f1b
parente66244521c6e5f37b2964ea5165c6ac9b854b9c7 (diff)
downloadcpython-9cd7e17640a49635d1c1f8c2989578a8fc2c1de6.zip
cpython-9cd7e17640a49635d1c1f8c2989578a8fc2c1de6.tar.gz
cpython-9cd7e17640a49635d1c1f8c2989578a8fc2c1de6.tar.bz2
Fix #29519: weakref spewing exceptions during interp finalization
-rw-r--r--Lib/weakref.py4
-rw-r--r--Misc/NEWS3
2 files changed, 5 insertions, 2 deletions
diff --git a/Lib/weakref.py b/Lib/weakref.py
index aaebd0c..787e33a 100644
--- a/Lib/weakref.py
+++ b/Lib/weakref.py
@@ -106,7 +106,7 @@ class WeakValueDictionary(collections.MutableMapping):
self, *args = args
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:
@@ -114,7 +114,7 @@ class WeakValueDictionary(collections.MutableMapping):
else:
# Atomic removal is necessary since this function
# can be called asynchronously by the GC
- _remove_dead_weakref(d, wr.key)
+ _atomic_removal(d, wr.key)
self._remove = remove
# A list of keys to be removed
self._pending_removals = []
diff --git a/Misc/NEWS b/Misc/NEWS
index fa0e740..e1b32ad 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -23,6 +23,9 @@ Extension Modules
Library
-------
+- Issue #29519: Fix weakref spewing exceptions during interpreter shutdown
+ when used with a rare combination of multiprocessing and custom codecs.
+
- Issue #29416: Prevent infinite loop in pathlib.Path.mkdir
- Issue #29444: Fixed out-of-bounds buffer access in the group() method of