Existing asyncio features scheduled for removal in Python 3.9 and 3.10

Hi everyone, There are a couple of uncompleted asyncio feature removals scheduled for 3.9 and 3.10 releases. It will be great if we either complete them or reschedule before the 3.10 feature freeze. There are two stale pull requests related to this. Removal of @asyncio.coroutine in version 3.10 deprecated since version 3.8 Documentation: https://docs.python.org/3.10/library/asyncio-task.html#asyncio.coroutine Issue deprecating the decorator: https://bugs.python.org/issue36921 Issue for the removal: https://bugs.python.org/issue43216 There is no pull request yet, mainly because of an unclarified question regarding types.coroutine in 36921. Prohibiting non-ThreadPoolExecutor in loop.set_default_executor Warning scheduling the prohibiting in version 3.9: https://github.com/python/cpython/blob/425434dadc30d96dc1c0c628f954f9b6f5edd... Issue: https://bugs.python.org/issue43234 Stale pull request: https://github.com/python/cpython/pull/24540 Prohibiting previously deprecated operations on asyncio.trsock.TransportSocket Warning scheduling the prohibiting in version 3.9: https://github.com/python/cpython/blob/425434dadc30d96dc1c0c628f954f9b6f5edd... Issue: https://bugs.python.org/issue43232 Stale pull request: https://github.com/python/cpython/pull/24538 Thanks, Illia

I don't understand how it's possible to "Deprecate @coroutine for sake of async def" when native coroutines ultimately depend on a generator to be driven by the event loop. What am I missing? Perhaps in asyncio the generator magic is now written in C, but as Nathaniel J. Smith points out, Trio and Curio both use Python generators at their cores. Cheers, Luciano On Mon, Apr 26, 2021 at 5:55 PM Illia Volochii <illia.volochii@gmail.com> wrote:
Hi everyone,
There are a couple of uncompleted asyncio feature removals scheduled for 3.9 and 3.10 releases. It will be great if we either complete them or reschedule before the 3.10 feature freeze. There are two stale pull requests related to this.
Removal of @asyncio.coroutine in version 3.10 deprecated since version 3.8 Documentation: https://docs.python.org/3.10/library/asyncio-task.html#asyncio.coroutine Issue deprecating the decorator: https://bugs.python.org/issue36921 Issue for the removal: https://bugs.python.org/issue43216 There is no pull request yet, mainly because of an unclarified question regarding types.coroutine in 36921.
Prohibiting non-ThreadPoolExecutor in loop.set_default_executor Warning scheduling the prohibiting in version 3.9: https://github.com/python/cpython/blob/425434dadc30d96dc1c0c628f954f9b6f5edd... Issue: https://bugs.python.org/issue43234 Stale pull request: https://github.com/python/cpython/pull/24540
Prohibiting previously deprecated operations on asyncio.trsock.TransportSocket Warning scheduling the prohibiting in version 3.9: https://github.com/python/cpython/blob/425434dadc30d96dc1c0c628f954f9b6f5edd... Issue: https://bugs.python.org/issue43232 Stale pull request: https://github.com/python/cpython/pull/24538
Thanks, Illia _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/PLSLFTJX... Code of Conduct: http://python.org/psf/codeofconduct/
-- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Technical Principal at ThoughtWorks | Twitter: @ramalhoorg

@asyncio.coroutine and @types.coroutine are different beasts. @asyncio.coroutine is the deprecated one; @types.coroutine is lower-level and not deprecated. On Mon, Apr 26, 2021 at 2:48 PM Luciano Ramalho <luciano@ramalho.org> wrote:
I don't understand how it's possible to "Deprecate @coroutine for sake of async def" when native coroutines ultimately depend on a generator to be driven by the event loop.
What am I missing?
Perhaps in asyncio the generator magic is now written in C, but as Nathaniel J. Smith points out, Trio and Curio both use Python generators at their cores.
Cheers,
Luciano
On Mon, Apr 26, 2021 at 5:55 PM Illia Volochii <illia.volochii@gmail.com> wrote:
Hi everyone,
There are a couple of uncompleted asyncio feature removals scheduled for 3.9 and 3.10 releases. It will be great if we either complete them or reschedule before the 3.10 feature freeze. There are two stale pull requests related to this.
Removal of @asyncio.coroutine in version 3.10 deprecated since version 3.8 Documentation: https://docs.python.org/3.10/library/asyncio-task.html#asyncio.coroutine Issue deprecating the decorator: https://bugs.python.org/issue36921 Issue for the removal: https://bugs.python.org/issue43216 There is no pull request yet, mainly because of an unclarified question regarding types.coroutine in 36921.
Prohibiting non-ThreadPoolExecutor in loop.set_default_executor Warning scheduling the prohibiting in version 3.9: https://github.com/python/cpython/blob/425434dadc30d96dc1c0c628f954f9b6f5edd... Issue: https://bugs.python.org/issue43234 Stale pull request: https://github.com/python/cpython/pull/24540
Prohibiting previously deprecated operations on asyncio.trsock.TransportSocket Warning scheduling the prohibiting in version 3.9: https://github.com/python/cpython/blob/425434dadc30d96dc1c0c628f954f9b6f5edd... Issue: https://bugs.python.org/issue43232 Stale pull request: https://github.com/python/cpython/pull/24538
Thanks, Illia _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/PLSLFTJX... Code of Conduct: http://python.org/psf/codeofconduct/
-- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Technical Principal at ThoughtWorks | Twitter: @ramalhoorg _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/L3Y4TWVW... Code of Conduct: http://python.org/psf/codeofconduct/
-- Nathaniel J. Smith -- https://vorpus.org

On Mon, Apr 26, 2021 at 7:04 PM Nathaniel Smith <njs@pobox.com> wrote:
@asyncio.coroutine and @types.coroutine are different beasts. @asyncio.coroutine is the deprecated one; @types.coroutine is lower-level and not deprecated.
According to @Guido van Rossum in this message of Feb. 19, 2021 [1], @types.coroutine was not deprecated "due to an oversight" [1] https://mail.python.org/archives/list/python-dev@python.org/message/CEQQLON7... Relevant quote from GvR: """ It looks like types.coroutine will remain (it does not contain code to warn about deprecation like asyncio.coroutine does), but I don't think it is required to end a chain of coroutines -- it may have been an oversight that we did not start deprecating it. (But in any case it won't be supported by asyncio.) """ At that time, Guido presented an explanation about why asyncio can live without it. I thought it made sense to me at the time, but now I realize I did not understand the solution that involves a trampoline. It's OK, I am not looking for another explanation at this time. I was confused and concerned that this could affect Curio and Trio. Sorry for the noise. Cheers, Luciano On Mon, Apr 26, 2021 at 7:04 PM Nathaniel Smith <njs@pobox.com> wrote:
@asyncio.coroutine and @types.coroutine are different beasts. @asyncio.coroutine is the deprecated one; @types.coroutine is lower-level and not deprecated.
On Mon, Apr 26, 2021 at 2:48 PM Luciano Ramalho <luciano@ramalho.org> wrote:
I don't understand how it's possible to "Deprecate @coroutine for sake of async def" when native coroutines ultimately depend on a generator to be driven by the event loop.
What am I missing?
Perhaps in asyncio the generator magic is now written in C, but as Nathaniel J. Smith points out, Trio and Curio both use Python generators at their cores.
Cheers,
Luciano
On Mon, Apr 26, 2021 at 5:55 PM Illia Volochii <illia.volochii@gmail.com> wrote:
Hi everyone,
There are a couple of uncompleted asyncio feature removals scheduled for 3.9 and 3.10 releases. It will be great if we either complete them or reschedule before the 3.10 feature freeze. There are two stale pull requests related to this.
Removal of @asyncio.coroutine in version 3.10 deprecated since version 3.8 Documentation: https://docs.python.org/3.10/library/asyncio-task.html#asyncio.coroutine Issue deprecating the decorator: https://bugs.python.org/issue36921 Issue for the removal: https://bugs.python.org/issue43216 There is no pull request yet, mainly because of an unclarified question regarding types.coroutine in 36921.
Prohibiting non-ThreadPoolExecutor in loop.set_default_executor Warning scheduling the prohibiting in version 3.9: https://github.com/python/cpython/blob/425434dadc30d96dc1c0c628f954f9b6f5edd... Issue: https://bugs.python.org/issue43234 Stale pull request: https://github.com/python/cpython/pull/24540
Prohibiting previously deprecated operations on asyncio.trsock.TransportSocket Warning scheduling the prohibiting in version 3.9: https://github.com/python/cpython/blob/425434dadc30d96dc1c0c628f954f9b6f5edd... Issue: https://bugs.python.org/issue43232 Stale pull request: https://github.com/python/cpython/pull/24538
Thanks, Illia _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/PLSLFTJX... Code of Conduct: http://python.org/psf/codeofconduct/
-- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Technical Principal at ThoughtWorks | Twitter: @ramalhoorg _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/L3Y4TWVW... Code of Conduct: http://python.org/psf/codeofconduct/
-- Nathaniel J. Smith -- https://vorpus.org
-- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Technical Principal at ThoughtWorks | Twitter: @ramalhoorg

Hi, On Mon, Apr 26, 2021 at 10:51 PM Illia Volochii <illia.volochii@gmail.com> wrote:
There are a couple of uncompleted asyncio feature removals scheduled for 3.9 and 3.10 releases. It will be great if we either complete them or reschedule before the 3.10 feature freeze. There are two stale pull requests related to this.
I would prefer to wait for 3.11 to remove more deprecated features, these ones can survive a little bit longer. If possible, I suggest to remove functions at the beginning of a new Python development cycle, rather than just before the feature freeze. So projects tested with the development branch of Python can detect issues early and we can more time to either fix these projects, or to consider reverting the removals to give more time for updating these projects. It's common that we forget to remove deprecated functions and so that documentation is not accurate. IMO it's not a big deal ;-) Victor -- Night gathers, and now my watch begins. It shall not end until my death.

I would prefer to wait for 3.11 to remove more deprecated features, these ones can survive a little bit longer.
If possible, I suggest to remove functions at the beginning of a new Python development cycle, rather than just before the feature freeze. So projects tested with the development branch of Python can detect issues early and we can more time to either fix these projects, or to consider reverting the removals to give more time for updating these projects.
Fair enough, Victor :)
It's common that we forget to remove deprecated functions and so that documentation is not accurate. IMO it's not a big deal ;-)
Do you think it is worth updating the documentation and warnings related to the asyncio features to state that they will be removed in Python 3.11 instead of 3.9 or 3.10?

On May 2, 2021, at 4:25 PM, Illia Volochii <illia.volochii@gmail.com> wrote:
I would prefer to wait for 3.11 to remove more deprecated features, these ones can survive a little bit longer.
If possible, I suggest to remove functions at the beginning of a new Python development cycle, rather than just before the feature freeze. So projects tested with the development branch of Python can detect issues early and we can more time to either fix these projects, or to consider reverting the removals to give more time for updating these projects.
Fair enough, Victor :)
It's common that we forget to remove deprecated functions and so that documentation is not accurate. IMO it's not a big deal ;-)
Do you think it is worth updating the documentation and warnings related to the asyncio features to state that they will be removed in Python 3.11 instead of 3.9 or 3.10?
I think that’s a good idea. Eric
participants (5)
-
Eric V. Smith
-
Illia Volochii
-
Luciano Ramalho
-
Nathaniel Smith
-
Victor Stinner