bpo-31061: fix crash in asyncio speedup module by thehesiod · Pull Request #2966 · python/cpython (original) (raw)
CPython's circular reference GC uses doubly linked list to track object which can be member of circular reference.PyObject_GC_UnTrack()
removes object from the list, and PyObject_GC_Track()
insert the object to the list.
Despite very undetarministic multithreading, I can cause SEGV quickly with this code:
import asyncio
import gc
gc.set_debug(gc.DEBUG_STATS)
class Evil:
def __del__(self):
gc.collect()
def main():
f = asyncio.Future()
f.set_result(Evil())
for i in range(100):
main()