[issue20032] asyncio.Future.set_exception() creates a reference cycle

STINNER Victor report at bugs.python.org
Fri Dec 20 23:37:14 CET 2013


STINNER Victor added the comment:

"The cycle will be cleaned up (and the message printed) when the
garbage collector runs next."

Oh, ok. Using the following task, the object is correctly deleted.
---
@asyncio.coroutine
def idle():
    while 1:
        gc.collect()
        yield from asyncio.sleep(0.1)

asyncio.Task(idle())
---

"Maybe it's time to look into
http://code.google.com/p/tulip/issues/detail?id=42 ? (It proposes to
run gc.collect() occasionally when the loop is idle.)"

I don't like such task. The issue can be documented, maybe with an example of call calling gc.collect() regulary? Such background task should be implemented in the application to control when the garbage collector is called.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20032>
_______________________________________


More information about the Python-bugs-list mailing list