Skip to content

Commit 73188fd

Browse files
committed
fix(event-loop): await pm.wait() hangs if no async calls at all
1 parent 9ff5f57 commit 73188fd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/PyEventLoop.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ public:
186186
PyObject *asyncio = PyImport_ImportModule("asyncio");
187187
_queueIsEmpty = PyObject_CallMethod(asyncio, "Event", NULL); // _queueIsEmpty = asyncio.Event()
188188
Py_DECREF(asyncio);
189+
190+
// The flag should initially be set as the queue is initially empty
191+
Py_XDECREF(PyObject_CallMethod(_queueIsEmpty, "set", NULL)); // _queueIsEmpty.set()
189192
};
190193
~Lock() {
191194
Py_DECREF(_queueIsEmpty);

0 commit comments

Comments
 (0)