Skip to content

Commit fbde410

Browse files
committed
Make event_input ignore EAGAIN errors
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().
1 parent d0d01c4 commit fbde410

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/sequencer_alsa/sequencer_alsa.i

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ event_input(snd_seq_t *handle)
3737
int err;
3838
snd_seq_event_t *ev;
3939
err = snd_seq_event_input(handle, &ev);
40+
if (err == -EAGAIN)
41+
{
42+
Py_INCREF(Py_None);
43+
return Py_None;
44+
}
4045
if (err < 0)
4146
{
4247
PyErr_SetString(PyExc_IOError, snd_strerror(err));

0 commit comments

Comments
 (0)