Skip to content

Commit ca71bea

Browse files
committed
fix(event-loop): uncaught python SystemError when JS error in setTimeout callback
SystemError: <built-in method eventLoopJobWrapper of builtin_function_or_method object> returned a result with an exception set
1 parent 122ce26 commit ca71bea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/PyEventLoop.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ static PyObject *eventLoopJobWrapper(PyObject *jobFn, PyObject *Py_UNUSED(_)) {
99
PyObject *ret = PyObject_CallObject(jobFn, NULL); // jobFn()
1010
Py_XDECREF(ret); // don't care about its return value
1111
PyEventLoop::_locker->decCounter();
12-
Py_RETURN_NONE;
12+
if (PyErr_Occurred()) {
13+
return NULL;
14+
} else {
15+
Py_RETURN_NONE;
16+
}
1317
}
1418
static PyMethodDef jobWrapperDef = {"eventLoopJobWrapper", eventLoopJobWrapper, METH_NOARGS, NULL};
1519

0 commit comments

Comments
 (0)