changeset: 106485:2cb530243943 branch: 3.5 parent: 106473:c63b09833141 user: Ɓukasz Langa date: Fri Feb 10 00:14:55 2017 -0800 files: Lib/weakref.py Misc/NEWS description: Fix #29519: weakref spewing exceptions during interp finalization diff -r c63b09833141 -r 2cb530243943 Lib/weakref.py --- a/Lib/weakref.py Thu Feb 09 16:03:59 2017 +0100 +++ b/Lib/weakref.py Fri Feb 10 00:14:55 2017 -0800 @@ -106,7 +106,7 @@ 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 @@ 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 -r c63b09833141 -r 2cb530243943 Misc/NEWS --- a/Misc/NEWS Thu Feb 09 16:03:59 2017 +0100 +++ b/Misc/NEWS Fri Feb 10 00:14:55 2017 -0800 @@ -23,6 +23,9 @@ 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