Skip to content

Commit

Permalink
python callback tracebacks
Browse files Browse the repository at this point in the history
git-svn-id: http://abstrakraft.org/cwiid/svn/trunk@154 918edb2d-ff29-0410-9de2-eb38e7f22bc7
  • Loading branch information
abstrakraft authored and dsmith committed Jan 20, 2008
1 parent 4a75633 commit 486219f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions python/Wiimote.c
Expand Up @@ -19,6 +19,9 @@
* Boston, MA 02110-1301 USA
*
* ChangeLog:
* 2008-01-19 L. Donnie Smith <cwiid@abstrakraft.org>
* * print callback error tracebacks
*
* 2007-06-18 L. Donnie Smith <cwiid@abstrakraft.org>
* * revised error messages and doc strings
*
Expand Down Expand Up @@ -682,9 +685,8 @@ static PyObject *Wiimote_write(Wiimote *self, PyObject *args, PyObject *kwds)
Py_RETURN_NONE;
}

static void
CallbackBridge(cwiid_wiimote_t *wiimote, int mesg_count,
union cwiid_mesg mesg[], struct timespec *t)
static void CallbackBridge(cwiid_wiimote_t *wiimote, int mesg_count,
union cwiid_mesg mesg[], struct timespec *t)
{
PyObject *ArgTuple;
PyObject *PySelf;
Expand All @@ -696,7 +698,10 @@ static void

/* Put id and the list of messages as the arguments to the callback */
PySelf = (PyObject *) cwiid_get_data(wiimote);
PyObject_CallFunction(((Wiimote *)PySelf)->callback, "(O)", ArgTuple);
if (!PyObject_CallFunction(((Wiimote *)PySelf)->callback, "(O)",
ArgTuple)) {
PyErr_Print();
}

Py_XDECREF(ArgTuple);
PyGILState_Release(gstate);
Expand Down

0 comments on commit 486219f

Please sign in to comment.