gpiod_Line_event_wait() works differently than its LineBulk
counterpart. While the latter returns either a list of lines or False,
the former returns True if an event occurred on this line or False
otherwise.
False is not a good counterpart for an actual object, so instead return
None if no events occurred on any of the monitored lines.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Py_DECREF(bulk_obj);
if (!events)
return NULL;
- if (events == Py_False)
- return Py_False;
+
+ if (events == Py_None) {
+ Py_DECREF(Py_None);
+ Py_RETURN_FALSE;
+ }
Py_DECREF(events);
Py_RETURN_TRUE;
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
} else if (rv == 0) {
- Py_RETURN_FALSE;
+ Py_RETURN_NONE;
}
ret = PyList_New(gpiod_line_bulk_num_lines(&ev_bulk));