commit fc5fc4f4abb03f869af686002623b346cd39812d
parent 8ea32983aea01706ca01ce1996e69be9b32b4570
Author: Joris Vink <joris@coders.se>
Date: Tue, 23 Oct 2018 21:36:19 +0200
make sure timers don't go out of scope.
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/python.c b/src/python.c
@@ -1014,6 +1014,7 @@ python_kore_timer(PyObject *self, PyObject *args)
timer->callable = obj;
timer->run = kore_timer_add(pytimer_run, ms, timer, flags);
+ Py_INCREF((PyObject *)timer);
Py_INCREF(timer->callable);
return ((PyObject *)timer);
@@ -1169,6 +1170,7 @@ pytimer_close(struct pytimer *timer, PyObject *args)
timer->callable = NULL;
}
+ Py_INCREF((PyObject *)timer);
Py_RETURN_TRUE;
}