[issue38006] Crash in remove() weak reference callback of weakref.WeakValueDictionary at Python exit
Neil Schemenauer
report at bugs.python.org
Sun Sep 29 21:06:31 EDT 2019
Neil Schemenauer <nas-python at arctrix.com> added the comment:
Since W is in the unreachable set, we should not be executing its callback. Would the attached rough patch (gc_disable_wr_callback.txt) be a possible fix? When we find W inside handle_weakrefs(), we mark it as trash and will not execute the callback.
This is similar to Pablo's bpo-38009 but I think attacks the problem in a better way. Having func_clear() being run is only one possible bad outcome of executing the callback. We want to avoid executing *any* user level Python code if the weakref has access to objects found by the GC and which have tp_clear called on them.
----------
Added file: https://bugs.python.org/file48630/gc_disable_wr_callback.txt
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38006>
_______________________________________
More information about the Python-bugs-list
mailing list