X Tutup
Skip to content

Commit 6737ab6

Browse files
committed
return None on EAGAIN in read_one() instead of raising an IOError
1 parent 3a06ac0 commit 6737ab6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

doc/changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Changelog
22
=========
33

4+
0.4.4 (Jun 04, 2014)
5+
^^^^^^^^^^^^^^^^^^^^
6+
7+
Fixes:
8+
- Calling ``InputDevice.read_one()`` should always return
9+
``None``, when there is nothing to be read, even in case of a
10+
``EAGAIN`` errno (thanks JPP).
11+
412
0.4.3 (Dec 19, 2013)
513
^^^^^^^^^^^^^^^^^^^^
614

evdev/input.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ device_read(PyObject *self, PyObject *args)
4747
int n = read(fd, &event, sizeof(event));
4848

4949
if (n < 0) {
50+
if (errno == EAGAIN) {
51+
Py_INCREF(Py_None);
52+
return Py_None;
53+
}
54+
5055
PyErr_SetFromErrno(PyExc_IOError);
5156
return NULL;
5257
}

0 commit comments

Comments
 (0)
X Tutup