Tim Peters <t...@python.org> added the comment:
> 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. It's semantically correct since we never wanted to execute a callback from a trash weakref to begin with. The nature of the error violated that intent: the callback from a trash weakref occurs outside gcmodule, where it has no idea that the weakref is trash. After your patch, it would know. How effective is it? Well, failure modes "like this" ;-) If a callback function is trash, delete_garbage will eventually clear it. But if the function is trash the weakref containing it must also be trash (if it weren't trash, neither would be the reachable-from-it callback function). Then since the containing weakref is trash, your patch will find it and prevent the callback. So this "should" fix the original problem, even if tp_clear were restored for function objects (which it probably should be). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38006> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com