Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
📜🤖 Added by blurb_it.
  • Loading branch information
blurb-it[bot] authored Jul 6, 2022
commit 9576a912cacf5f27d49ebbf634be3904a748774e
8 changes: 4 additions & 4 deletions Lib/asyncio/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ async def main():
raise RuntimeError(
"asyncio.run() cannot be called from a running event loop")

with Runner(debug=debug) as runner:
try:
try:
with Runner(debug=debug) as runner:
events.set_event_loop(runner.get_loop())
return runner.run(main)
finally:
events.set_event_loop(None)
finally:
events.set_event_loop(None)
Comment thread
kumaraditya303 marked this conversation as resolved.
Outdated


def _cancel_all_tasks(loop):
Expand Down
1 change: 0 additions & 1 deletion Lib/unittest/async_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def _setupAsyncioRunner(self):
def _tearDownAsyncioRunner(self):
Comment thread
kumaraditya303 marked this conversation as resolved.
runner = self._asyncioRunner
runner.close()
asyncio.set_event_loop(None)

def run(self, result=None):
self._setupAsyncioRunner()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix :func:`asyncio.run` and :class:`unittest.IsolatedAsyncioTestCase` to always the set event loop as it was done in Python 3.10 and earlier. Patch by Kumar Aditya.