Skip to content

Commit 11ecd2e

Browse files
committed
Raise an exception when returning NULL
Signed-off-by: Alberto Planas <[email protected]>
1 parent fc196f0 commit 11ecd2e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

psutil/arch/linux/users.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ psutil_users_systemd(PyObject *self, PyObject *args) {
164164
if (sessions_list)
165165
free(sessions_list);
166166
dlclose(handle);
167+
PyErr_SetString(PyExc_RuntimeError, "cannot get user information via systemd");
167168
return NULL;
168169
}
169170

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

0 commit comments

Comments
 (0)