diff options
author | Shantanu <12621235+hauntsaninja@users.noreply.github.com> | 2020-09-02 21:54:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-02 21:54:46 -0700 |
commit | 0770ad948cb6d9f7f6c4002efd83e27c27069808 (patch) | |
tree | b3b40d1fa497c21ed6475f83279713dd7722e3b2 /Lib/asyncio/runners.py | |
parent | 4a97b1517a6b5ff22e2984b677a680b07ff0ce11 (diff) | |
download | cpython-git-0770ad948cb6d9f7f6c4002efd83e27c27069808.tar.gz |
bpo-41696: Fix handling of debug mode in asyncio.run (#22069)
* bpo-41696: Fix handling of debug mode in asyncio.run
This allows PYTHONASYNCIODEBUG or -X dev to enable asyncio debug mode
when using asyncio.run
* 📜🤖 Added by blurb_it.
Co-authored-by: hauntsaninja <>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Diffstat (limited to 'Lib/asyncio/runners.py')
-rw-r--r-- | Lib/asyncio/runners.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/asyncio/runners.py b/Lib/asyncio/runners.py index 03ce33300e..268635d68f 100644 --- a/Lib/asyncio/runners.py +++ b/Lib/asyncio/runners.py @@ -5,7 +5,7 @@ from . import events from . import tasks -def run(main, *, debug=False): +def run(main, *, debug=None): """Execute the coroutine and return the result. This function runs the passed coroutine, taking care of @@ -39,7 +39,8 @@ def run(main, *, debug=False): loop = events.new_event_loop() try: events.set_event_loop(loop) - loop.set_debug(debug) + if debug is not None: + loop.set_debug(debug) return loop.run_until_complete(main) finally: try: |