Skip to content

Commit

Permalink
Fix #29519: weakref spewing exceptions during interp finalization
Browse files Browse the repository at this point in the history
  • Loading branch information
ambv committed Feb 10, 2017
1 parent e662445 commit 9cd7e17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/weakref.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ def __init__(*args, **kw):
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:
self._pending_removals.append(wr.key)
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 = []
Expand Down
3 changes: 3 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9cd7e17

Please sign in to comment.