New submission from Peter Inglesby: The following code causes a segfault when run under Python3.4+ on OSX10.9.
# segfaulter.py import asyncio class A: pass class B: def __init__(self, future): self.future = future def __del__(self): self.a = None @asyncio.coroutine def do_work(future): a = A() b = B(asyncio.Future()) a.b = b b.a = a future.set_result(None) future = asyncio.Future() asyncio.Task(do_work(future)) loop = asyncio.get_event_loop() loop.run_until_complete(future) It does matter that the Future is passed to b's __init__ method. It doesn't matter whether the Future has been resolved. Attached is the problem report generated by OSX on the crash. ---------- files: problemreport.txt messages: 217918 nosy: inglesp priority: normal severity: normal status: open title: Segfault with cyclic reference and asyncio.Future type: crash versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file35152/problemreport.txt _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21435> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com