GH-99388: add loop_factory parameter to asyncio.run (#99462)

This commit is contained in:
Kumar Aditya 2022-11-14 23:48:51 +05:30 committed by GitHub
parent f5e326e2b6
commit f63002755d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 6 deletions

View file

@ -157,7 +157,7 @@ class Runner:
raise KeyboardInterrupt()
def run(main, *, debug=None):
def run(main, *, debug=None, loop_factory=None):
"""Execute the coroutine and return the result.
This function runs the passed coroutine, taking care of
@ -190,7 +190,7 @@ def run(main, *, debug=None):
raise RuntimeError(
"asyncio.run() cannot be called from a running event loop")
with Runner(debug=debug) as runner:
with Runner(debug=debug, loop_factory=loop_factory) as runner:
return runner.run(main)