Skip to content
Merged
Changes from all commits
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
7 changes: 6 additions & 1 deletion qasync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class _QEventLoop:
... loop.run_until_complete(xplusy(2, 2))
"""

def __init__(self, app=None, set_running_loop=True):
def __init__(self, app=None, set_running_loop=True, already_running=False):
self.__app = app or QApplication.instance()
assert self.__app is not None, 'No QApplication has been instantiated'
self.__is_running = False
Expand All @@ -278,6 +278,11 @@ def __init__(self, app=None, set_running_loop=True):
if set_running_loop:
asyncio.events._set_running_loop(self)

# We have to set __is_running to True after calling
# super().__init__() because of a bug in BaseEventLoop.
if already_running:
self.__is_running = True

def run_forever(self):
"""Run eventloop forever."""
self.__is_running = True
Expand Down