diff options
Diffstat (limited to 'psutil/_psutil_osx.c')
-rw-r--r-- | psutil/_psutil_osx.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_osx.c index 2470c3eb..cd375bab 100644 --- a/psutil/_psutil_osx.c +++ b/psutil/_psutil_osx.c @@ -955,6 +955,10 @@ psutil_proc_open_files(PyObject *self, PyObject *args) { if (! PyArg_ParseTuple(args, _Py_PARSE_PID, &pid)) goto error; + // see: https://github.com/giampaolo/psutil/issues/2116 + if (pid == 0) + return py_retlist; + fds_pointer = psutil_proc_list_fds(pid, &num_fds); if (fds_pointer == NULL) goto error; @@ -1047,6 +1051,10 @@ psutil_proc_connections(PyObject *self, PyObject *args) { goto error; } + // see: https://github.com/giampaolo/psutil/issues/2116 + if (pid == 0) + return py_retlist; + if (!PySequence_Check(py_af_filter) || !PySequence_Check(py_type_filter)) { PyErr_SetString(PyExc_TypeError, "arg 2 or 3 is not a sequence"); goto error; |