[issue38559] async generators aclose() behavior in 3.8

2019-10-23 Thread Yury Selivanov
Yury Selivanov added the comment: The more I think about this the more I like new 3.8 behavior. I'm going to close this issue; if anything comes up I'll reopen it later. Sorry for the noise. -- resolution: -> not a bug stage: -> resolved status: open -> closed

[issue38559] async generators aclose() behavior in 3.8

2019-10-22 Thread Yury Selivanov
Yury Selivanov 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

[issue38559] async generators aclose() behavior in 3.8

2019-10-22 Thread Nathaniel Smith
Nathaniel Smith added the comment: I think conceptually, cancelling all tasks and waiting for them to exit is the right thing to do. That way you run as much shutdown code as possible in regular context, and also avoid this problem – if there are no tasks, then there can't be any tasks

[issue38559] async generators aclose() behavior in 3.8

2019-10-22 Thread Yury Selivanov
Yury Selivanov added the comment: Just discussed this issue off-list with Nathaniel. Maybe this isn't as severe as I thought it is. If we cancel all asyncio tasks before calling `loop.shutdown_asyncgens()` this *probably* becomes a non-issue. And "asyncio.run()" does just that [1]. Any

[issue38559] async generators aclose() behavior in 3.8

2019-10-22 Thread Yury Selivanov
New submission from Yury Selivanov : I believe I might have discovered a problem with asynchronous generators in 3.8. # Prelude In Python prior to 3.8 it was possible to overlap running of "asend()" and "athrow()" methods for the same asynchronous generator. In plain English, it was