aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/QtAsyncio/tasks.py
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/PySide6/QtAsyncio/tasks.py')
-rw-r--r--sources/pyside6/PySide6/QtAsyncio/tasks.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/sources/pyside6/PySide6/QtAsyncio/tasks.py b/sources/pyside6/PySide6/QtAsyncio/tasks.py
index 6777b8bc3..c04006686 100644
--- a/sources/pyside6/PySide6/QtAsyncio/tasks.py
+++ b/sources/pyside6/PySide6/QtAsyncio/tasks.py
@@ -64,19 +64,18 @@ class QAsyncioTask(futures.QAsyncioFuture):
result = None
self._future_to_await = None
+ if asyncio.futures.isfuture(exception_or_future):
+ try:
+ exception_or_future.result()
+ except BaseException as e:
+ exception_or_future = e
+
try:
asyncio._enter_task(self._loop, self) # type: ignore[arg-type]
- if exception_or_future is None:
- result = self._coro.send(None)
- elif asyncio.futures.isfuture(exception_or_future):
- try:
- exception_or_future.result()
- except BaseException as e:
- result = self._coro.throw(e)
- else:
- result = self._coro.send(None)
- elif isinstance(exception_or_future, BaseException):
+ if isinstance(exception_or_future, BaseException):
result = self._coro.throw(exception_or_future)
+ else:
+ result = self._coro.send(None)
except StopIteration as e:
self._state = futures.QAsyncioFuture.FutureState.DONE_WITH_RESULT
self._result = e.value