Message353592
> 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). |
|
Date |
User |
Action |
Args |
2019-09-30 16:22:22 | tim.peters | set | recipients:
+ tim.peters, nascheme, pitrou, vstinner, christian.heimes, petr.viktorin, methane, lukasz.langa, Mark.Shannon, jdemeyer, pablogsal, miss-islington |
2019-09-30 16:22:22 | tim.peters | set | messageid: <1569860542.68.0.733087110047.issue38006@roundup.psfhosted.org> |
2019-09-30 16:22:22 | tim.peters | link | issue38006 messages |
2019-09-30 16:22:22 | tim.peters | create | |
|