Skip to content

Commit

Permalink
#1040: remove dead unicode C code
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed May 2, 2017
1 parent a769d80 commit 9c6e126
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions psutil/_psutil_sunos.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,19 @@ psutil_proc_name_and_args(PyObject *self, PyObject *args) {
if (! psutil_file_to_struct(path, (void *)&info, sizeof(info)))
return NULL;

#if PY_MAJOR_VERSION >= 3
// TODO: probably have to Py_INCREF here.
py_name = PyUnicode_DecodeFSDefault(info.pr_fname);
if (!py_name)
return NULL;
goto error;
py_args = PyUnicode_DecodeFSDefault(info.pr_psargs);
if (!py_args)
return NULL;
goto error;
return Py_BuildValue("OO", py_name, py_args);
#else
return Py_BuildValue("ss", info.pr_fname, info.pr_psargs);
#endif

error:
Py_XDECREF(py_name);
Py_XDECREF(py_args);
return NULL;
}


Expand Down

0 comments on commit 9c6e126

Please sign in to comment.