Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Simplify run() method
Browse files Browse the repository at this point in the history
  • Loading branch information
erdewit committed Jul 28, 2023
1 parent 9d46de9 commit 7868510
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions nest_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ def _patch_asyncio():
"""Patch asyncio module to use pure Python tasks and futures."""

def run(main, *, debug=False):
try:
loop = asyncio.get_event_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
_patch_loop(loop)
loop = asyncio.get_event_loop()
loop.set_debug(debug)
task = asyncio.ensure_future(main)
try:
Expand Down

0 comments on commit 7868510

Please sign in to comment.