-
-
Notifications
You must be signed in to change notification settings - Fork 79
Upstream contribution #51
Comments
There is the original discussion thread here, where the explicit decision is made to not allow nesting. The main objection by GvR is
This is a valid concern and care should be taking to not to exceed the recursion limit (1000 by default). When the recursion does get too deep, the long stack trace makes it very obvious what is happening though. |
At the same time, I don't think his argument:
really applies to the issue we are faced with. It is not a matter of making some code less elegant, but we have no other choice than using nest-asyncio or running another event loop in another thread (or using something like unasync), and none of them are ideal. |
Maybe some people are changing their minds about this now: https://bugs.python.org/issue22239#msg398257 |
I think nest asyncio breaks a fundamental assumption that in if you don't |
Good point, although with nest-asyncio |
I went ahead an opened python/cpython#93338. I hope you don't mind @erdewit, and of course if the PR is accepted you should be the author of it. |
That's a great idea @davidbrochart. I think if the asyncio authors do want nesting then it might be easier for them to modify their own code then it is to copy the (simplified) nest_asyncio code over. Probably they'll also want a flag like |
Yes, also the equivalent changes would need to be made in the C implementation.
I agree, although it seems difficult to handle the case where two libraries want different behaviors (one wants nesting, the other not). |
Thanks for this library, it really saves our lives.
I was thinking, since it is so useful, have you considered contributing to CPython to make this feature standard in asyncio? Or do you see issues that would prevent from doing it? Sorry if there are already discussions about it, but I couldn't find any.
The text was updated successfully, but these errors were encountered: