@ defer.inlineCallbacks expects the decorated function to be a generator function and will call the generator function inside the decorated function (even returning it), does not make the function, the generator function. Study:
def gen(): yield 1 def func(): return gen import dis dis.dis(gen) 2 0 LOAD_CONST 1 (1) 3 YIELD_VALUE 4 POP_TOP 5 LOAD_CONST 0 (None) 8 RETURN_VALUE dis.dis(func) 1 0 LOAD_GLOBAL 0 (gen) 3 RETURN_VALUE import inspect inspect.isgeneratorfunction(gen) True inspect.isgeneratorfunction(func) False
Thus, the only way to satisfy @ defer.inlineCallbacks is either yield delayed from self.signals.send_catch_log_deferred (signal = signals.engine_started) or from another place.
source share