Browse Source

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.
rdb 4 years ago
parent
commit
a64dcd7c5d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      panda/src/event/pythonTask.cxx

+ 2 - 2
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;