From a64dcd7c5dad91eb86ff0b8756137e7952364cca Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 7 Feb 2021 14:53:15 +0100 Subject: [PATCH] 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. --- panda/src/event/pythonTask.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/event/pythonTask.cxx b/panda/src/event/pythonTask.cxx index 8d7e351394..adebb3e2b7 100644 --- a/panda/src/event/pythonTask.cxx +++ b/panda/src/event/pythonTask.cxx @@ -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;