Small improvement to the Python kore.timer() api.

Do not allow kore.timer() to be called from the parent process
as it shouldn't be run there.

This makes Kore fail more gracefully.
This commit is contained in:
Joris Vink 2021-06-03 14:02:28 +02:00
parent f39919e98c
commit f1a65ef236
1 changed files with 6 additions and 0 deletions

View File

@ -2441,6 +2441,12 @@ python_kore_timer(PyObject *self, PyObject *args, PyObject *kwargs)
int flags;
struct pytimer *timer;
if (worker == NULL) {
PyErr_SetString(PyExc_RuntimeError,
"kore.timer not supported on parent process");
return (NULL);
}
if (!PyArg_ParseTuple(args, "OKi", &obj, &ms, &flags))
return (NULL);