[issue44680] Reference cycles from a WeakKeyDictionary value to its key aren’t collected

2021-07-19 Thread Anders Kaseorg
Anders Kaseorg added the comment: > extra_states[o] = ExtraState(obj) (Typo for extra_states[obj] = ExtraState(obj), obviously.) -- ___ Python tracker ___

[issue44680] Reference cycles from a WeakKeyDictionary value to its key aren’t collected

2021-07-19 Thread Anders Kaseorg
New submission from Anders Kaseorg : Because WeakKeyDictionary unconditionally maintains strong references to its values, the garbage collector fails to collect a reference cycle from a WeakKeyDictionary value to its key. For example, the following program unexpectedly leaks memory: from