[issue38599] Deprecate creation of asyncio object when the loop is not running

Yury Selivanov report at bugs.python.org
Mon Oct 28 18:23:41 EDT 2019


Yury Selivanov <yselivanov at gmail.com> added the comment:

> Well, I'm basically using a run method defined as a shorthand for self.loop.run_until_complete (without closing loop, reusing it throughout). It would be nice if asyncio.run could simply be used instead, but I understand you're saying this is easier said than done, which is fine with me. Thanks.

Yes. `asyncio.run()` is similar to `loop.run_until_complete()` but adds some guarantees + sane setup/cleanup. If we strip proper cleanup then there's no point in `asyncio.run()`.  So using `loop.run_until_complete()` is totally fine when you want to preserve the event loop between runs.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38599>
_______________________________________


More information about the Python-bugs-list mailing list