[issue25935] OrderedDict prevents garbage collection if a circulary referenced class is used as key

Serhiy Storchaka report at bugs.python.org
Mon Dec 28 16:49:14 EST 2015


Serhiy Storchaka added the comment:

An OrderedDict owns two references to every key (as a dict and from a linked list). Therefore it should visit it twice in tp_traverse.

Proposed patch fixes garbage collection for OrderedDict. It also rewrites OrderedDict clearing in more reentrant form (a linked list is detached from an OrderedDict before deallocating its nodes that can trigger executing user code).

----------
keywords: +patch
stage:  -> patch review
versions: +Python 3.6
Added file: http://bugs.python.org/file41441/odict_traverse.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25935>
_______________________________________


More information about the Python-bugs-list mailing list