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
10 changes: 6 additions & 4 deletions qasync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,11 @@ class _QEventLoop:
If the event loop shall be used with an existing and already running QApplication
it must be specified in the constructor via already_running=True
In this case the user is responsible for loop cleanup with stop() and close()

The set_running_loop parameter is there for backwards compatibility and does nothing.
"""

def __init__(self, app=None, set_running_loop=True, already_running=False):
def __init__(self, app=None, set_running_loop=False, 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 @@ -350,9 +352,6 @@ def __init__(self, app=None, set_running_loop=True, already_running=False):
assert self.__app is not None
super().__init__()

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:
Expand All @@ -363,6 +362,9 @@ def __init__(self, app=None, set_running_loop=True, already_running=False):
self._before_run_forever()
self.__app.aboutToQuit.connect(self._after_run_forever)

# for asyncio to recognize the already running loop
asyncio.events._set_running_loop(self)

def run_forever(self):
"""Run eventloop forever."""

Expand Down