Nathaniel Smith <n...@pobox.com> added the comment:

Oh! I see it. This is actually working as intended.

What's happening is that the event loop will clean up async generators when 
they're garbage collected... but, this requires that the event loop get a 
chance to run. In the demonstration program, the main task creates lots of 
async generator objects, but never returns to the main loop. So they're all 
queued up to be collected, but it can't actually happen until you perform a 
real async operation. For example, try adding 'await asyncio.sleep(1)` before 
the input() call so that the event loop has a chance to run, and you'll see 
that the objects are collected immediately.

So this is a bit tricky, but this is actually expected behavior, and falls 
under the general category of "don't block the event loop, it will break stuff".

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41229>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to