Skip to content

Commit

Permalink
Make event_input ignore EAGAIN errors
Browse files Browse the repository at this point in the history
When you're reading from a file descriptor in non-blocking mode and
there's nothing to read, you get an EAGAIN error.  We don't want to see
those as exceptions; we want to see a None value returned by
event_input().
  • Loading branch information
mgedmin committed Oct 10, 2017
1 parent d0d01c4 commit fbde410
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sequencer_alsa/sequencer_alsa.i
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ event_input(snd_seq_t *handle)
int err;
snd_seq_event_t *ev;
err = snd_seq_event_input(handle, &ev);
if (err == -EAGAIN)
{
Py_INCREF(Py_None);
return Py_None;
}
if (err < 0)
{
PyErr_SetString(PyExc_IOError, snd_strerror(err));
Expand Down

0 comments on commit fbde410

Please sign in to comment.