Skip to content

Commit 5d3be8c

Browse files
committed
_daemon,_reader: return ENOSYS instead of NotImplemented
In _reader we were raising OSError(errno=ENOSYS), but in _dameon we were raising NotImplementedError. Let's always use ENOSYS. Also, make the messages in _reader more specific. Fixes #33.
1 parent 5d1e3fb commit 5d3be8c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

systemd/_daemon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ static PyObject* notify(PyObject *self, PyObject *args, PyObject *keywds) {
145145
#ifdef HAVE_PID_NOTIFY
146146
r = sd_pid_notify(pid, unset, msg);
147147
#else
148-
PyErr_SetString(PyExc_NotImplementedError, "Compiled without support for sd_pid_notify");
148+
set_error(-ENOSYS, NULL, "Compiled without support for sd_pid_notify");
149149
return NULL;
150150
#endif
151151
} else {
152152
#ifdef HAVE_PID_NOTIFY_WITH_FDS
153153
r = sd_pid_notify_with_fds(pid, unset, msg, arr, n_fds);
154154
#else
155-
PyErr_SetString(PyExc_NotImplementedError, "Compiled without support for sd_pid_notify_with_fds");
155+
set_error(-ENOSYS, NULL, "Compiled without support for sd_pid_notify_with_fds");
156156
return NULL;
157157
#endif
158158
}

systemd/_reader.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ static PyObject* Reader_enumerate_fields(Reader *self, PyObject *args) {
10481048
_value_set = NULL;
10491049
return value_set;
10501050
#else
1051-
set_error(-ENOSYS, NULL, "Not implemented");
1051+
set_error(-ENOSYS, NULL, "Compiled without support for sd_journal_enumerate_fields");
10521052
return NULL;
10531053
#endif
10541054
}
@@ -1069,7 +1069,7 @@ static PyObject* Reader_has_runtime_files(Reader *self, PyObject *args) {
10691069

10701070
return PyBool_FromLong(r);
10711071
#else
1072-
set_error(-ENOSYS, NULL, "Not implemented");
1072+
set_error(-ENOSYS, NULL, "Compiled without support for sd_journal_has_runtime_files");
10731073
return NULL;
10741074
#endif
10751075
}
@@ -1090,7 +1090,7 @@ static PyObject* Reader_has_persistent_files(Reader *self, PyObject *args) {
10901090

10911091
return PyBool_FromLong(r);
10921092
#else
1093-
set_error(-ENOSYS, NULL, "Not implemented");
1093+
set_error(-ENOSYS, NULL, "Compiled without support for sd_journal_has_persistent_files");
10941094
return NULL;
10951095
#endif
10961096
}

0 commit comments

Comments
 (0)