Skip to content

Commit 20a1e76

Browse files
committed
QtAsyncio: Clarify usage of singleShot w/o context
The singleShot overload that accepts a context argument was used inside the do() method of the QAsyncioExecutorWrapper class, but this usage was unnecessary and adds confusion. Task-number: PYSIDE-769 Change-Id: Idcdd99eda6ae3bfd11ec50b9a42ff15ade005cc9 Reviewed-by: Cristian Maureira-Fredes <[email protected]> Reviewed-by: Christian Tismer <[email protected]>
1 parent 150a3fb commit 20a1e76

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sources/pyside6/PySide6/QtAsyncio/events.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ def do(self):
6363
self._loop = QEventLoop()
6464
asyncio.events._set_running_loop(self._loop)
6565

66-
QTimer.singleShot(0, self._loop, lambda: self._cb())
66+
# The do() function will always be executed from the new executor
67+
# thread and never from outside, so using the overload without the
68+
# context argument is sufficient.
69+
QTimer.singleShot(0, lambda: self._cb())
6770

6871
self._loop.exec()
6972
if self._exception is not None:

0 commit comments

Comments
 (0)