make sure timers don't go out of scope.

This commit is contained in:
Joris Vink 2018-10-23 21:36:19 +02:00
parent 8ea32983ae
commit fc5fc4f4ab
1 changed files with 2 additions and 0 deletions

View File

@ -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;
}