mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 15:25:54 -04:00
event: don't exit task if future __await__ yields None
This matches the behavior of asyncio's Task implementation, where this is the equivalent of `yield Task.cont`. I've kept regular generator tasks unaffected for now, since this might break existing usage.
This commit is contained in:
parent
af60f8200e
commit
f6b39345f7
@ -585,6 +585,11 @@ do_python_task() {
|
||||
return DS_done;
|
||||
}
|
||||
|
||||
} else if (result == Py_None && PyCoro_CheckExact(_generator)) {
|
||||
// Bare yield from a coroutine means to try again next frame.
|
||||
Py_DECREF(result);
|
||||
return DS_cont;
|
||||
|
||||
} else if (DtoolInstance_Check(result)) {
|
||||
// We are waiting for an AsyncFuture (eg. other task) to finish.
|
||||
AsyncFuture *fut = (AsyncFuture *)DtoolInstance_UPCAST(result, Dtool_AsyncFuture);
|
||||
|
Loading…
x
Reference in New Issue
Block a user