Yury Selivanov <yseliva...@gmail.com> added the comment:
> So I think asyncio.run is actually totally fine with the 3.8.0 behavior. Yes. Looks like it. > It's only explicit calls to shutdown_asyncgens that might run into this, and > I think that's probably OK? Yes. Calling shutdown_asyncgens after all tasks are cancelled is still useful to cleanup asynchronous generators that were created but not yet GCed or iterated. > And if we did allow aclose() to run at any time, then I worry that that could > cause serious problems. Users can call aclose() at will, and it's generally > good practice to always call aclose() on your async generators explicitly. So > it's entirely possible that users will accidentally call aclose() themselves > while they have another task is blocked in __anext__. And in that case.... > what do we do? I agree. Avoiding that kind of mess was the main motivation to fix ag_running. > So... this is super subtle and confusing, but I *think* the conclusion is > that yeah, 3.8.0 is fine and there's no urgent action needed. Let's see if anyone else thinks this might be a problem, but yeah, it seems that the only programs that can suffer from this change are those that don't use 'asyncio.run'. And if so they should be fixed to explicitly cancel all tasks before calling shutdown_asyncgens. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38559> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com