mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
GH-99388: add loop_factory
parameter to asyncio.run
(#99462)
This commit is contained in:
parent
f5e326e2b6
commit
f63002755d
5 changed files with 29 additions and 6 deletions
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue