Skip to content

Commit

Permalink
Raise an exception when returning NULL
Browse files Browse the repository at this point in the history
Signed-off-by: Alberto Planas <aplanas@suse.com>
  • Loading branch information
aplanas committed Oct 24, 2023
1 parent 25b8de0 commit 3c805be
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions psutil/arch/linux/users.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ psutil_users_systemd(PyObject *self, PyObject *args) {
Py_DECREF(py_retlist);
if (sessions_list)
free(sessions_list);
PyErr_SetString(PyExc_RuntimeError, "cannot get user information via systemd");
return NULL;
}

Expand Down Expand Up @@ -223,5 +224,6 @@ psutil_users_utmp(PyObject *self, PyObject *args) {
Py_XDECREF(py_tuple);
Py_DECREF(py_retlist);
endutent();
PyErr_SetString(PyExc_RuntimeError, "cannot get user information via utmp");
return NULL;
}

0 comments on commit 3c805be

Please sign in to comment.