Skip to content

Commit 785bcc0

Browse files
committed
safer
1 parent f5b819b commit 785bcc0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

qasync/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,8 @@ def _use_qeventloop(loop_factory):
833833
yield loop
834834
finally:
835835
loop.close()
836-
asyncio.set_event_loop(old_loop)
836+
if old_loop is not None:
837+
asyncio.set_event_loop(old_loop)
837838

838839
# A run function matching the signature of asyncio.run
839840
def run(main_coro, *, debug=None, loop_factory=None):

0 commit comments

Comments
 (0)