Skip to content

Commit 3c805be

Browse files
committed
Raise an exception when returning NULL
Signed-off-by: Alberto Planas <aplanas@suse.com>
1 parent 25b8de0 commit 3c805be

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

psutil/arch/linux/users.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ psutil_users_systemd(PyObject *self, PyObject *args) {
163163
Py_DECREF(py_retlist);
164164
if (sessions_list)
165165
free(sessions_list);
166+
PyErr_SetString(PyExc_RuntimeError, "cannot get user information via systemd");
166167
return NULL;
167168
}
168169

@@ -223,5 +224,6 @@ psutil_users_utmp(PyObject *self, PyObject *args) {
223224
Py_XDECREF(py_tuple);
224225
Py_DECREF(py_retlist);
225226
endutent();
227+
PyErr_SetString(PyExc_RuntimeError, "cannot get user information via utmp");
226228
return NULL;
227229
}

0 commit comments

Comments
 (0)