event: (BREAKING CHANGE) bare yield in task now means "cont"

This is more useful and consistent; you can after all just use "return" to end the task, whereas you can now just use "yield" to continue the next frame rather than "yield Task.cont".

This is a follow-up to f6b39345f718b3ea9e6d01e9e71c6265a8511e58, which already enabled this behavior when an __await__ (that is awaited from a task) yielded None.
This commit is contained in:
rdb 2021-02-07 14:53:15 +01:00
parent e8b4b6476c
commit a64dcd7c5d

View File

@ -624,8 +624,8 @@ 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.
} else if (result == Py_None) {
// Bare yield means to continue next frame.
Py_DECREF(result);
return DS_cont;