For both find_line() variants (Chip's method and global function)
return None if the internal call to the C find_line function fails
with ENOENT. This is not an error so don't raise an exception.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
line = gpiod_chip_find_line(self->chip, name);
Py_END_ALLOW_THREADS;
if (!line) {
+ if (errno == ENOENT) {
+ Py_INCREF(Py_None);
+ return (gpiod_LineObject *)Py_None;
+ }
+
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
line = gpiod_line_find(name);
Py_END_ALLOW_THREADS;
if (!line) {
+ if (errno == ENOENT) {
+ Py_INCREF(Py_None);
+ return (gpiod_LineObject *)Py_None;
+ }
+
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}