From 7316f372d149c046a8e06572c7bcd0fe592ea1a8 Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Thu, 4 Aug 2022 13:19:02 +0200 Subject: [PATCH] If no result was available, use Py_None. --- src/python.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/python.c b/src/python.c index 6254e4f..a2a29ca 100644 --- a/src/python.c +++ b/src/python.c @@ -4529,6 +4529,11 @@ pygather_reap_coro(struct pygather_op *op, struct python_coro *reap) PyErr_Fetch(&type, &coro->coro->result, &traceback); Py_DECREF(type); Py_XDECREF(traceback); + } else { + if (coro->coro->result == NULL) { + coro->coro->result = Py_None; + Py_INCREF(Py_None); + } } result->obj = coro->coro->result;