summaryrefslogtreecommitdiff
path: root/psutil/arch
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-05-01 08:21:00 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2017-05-01 08:21:00 +0200
commit0cab2d1f98b4814e87b930193e5316897d70d047 (patch)
tree4c6e217787561cc9517b6ff63191aefba69de225 /psutil/arch
parent043d5737d6eeab96aedd97f3a2fef35797304677 (diff)
downloadpsutil-0cab2d1f98b4814e87b930193e5316897d70d047.tar.gz
#1040: add replacement for PyUnicode_DecodeFSDefaultAndSize on Python 2; also get rid of the pstuil_ prefix and use the original Python names
Diffstat (limited to 'psutil/arch')
-rw-r--r--psutil/arch/bsd/freebsd.c12
-rw-r--r--psutil/arch/bsd/freebsd_socks.c4
-rw-r--r--psutil/arch/bsd/netbsd.c2
-rw-r--r--psutil/arch/bsd/netbsd_socks.c4
-rw-r--r--psutil/arch/osx/process_info.c4
5 files changed, 13 insertions, 13 deletions
diff --git a/psutil/arch/bsd/freebsd.c b/psutil/arch/bsd/freebsd.c
index 9a1f952c..11594b9d 100644
--- a/psutil/arch/bsd/freebsd.c
+++ b/psutil/arch/bsd/freebsd.c
@@ -238,7 +238,7 @@ psutil_get_cmdline(long pid) {
// separator
if (argsize > 0) {
while (pos < argsize) {
- py_arg = psutil_PyUnicode_DecodeFSDefault(&argstr[pos]);
+ py_arg = PyUnicode_DecodeFSDefault(&argstr[pos]);
if (!py_arg)
goto error;
if (PyList_Append(py_retlist, py_arg))
@@ -288,7 +288,7 @@ psutil_proc_exe(PyObject *self, PyObject *args) {
if (error == -1) {
// see: https://github.com/giampaolo/psutil/issues/907
if (errno == ENOENT)
- return psutil_PyUnicode_DecodeFSDefault("");
+ return PyUnicode_DecodeFSDefault("");
else
return PyErr_SetFromErrno(PyExc_OSError);
}
@@ -302,7 +302,7 @@ psutil_proc_exe(PyObject *self, PyObject *args) {
strcpy(pathname, "");
}
- return psutil_PyUnicode_DecodeFSDefault(pathname);
+ return PyUnicode_DecodeFSDefault(pathname);
}
@@ -555,7 +555,7 @@ psutil_proc_cwd(PyObject *self, PyObject *args) {
for (i = 0; i < cnt; i++) {
kif = &freep[i];
if (kif->kf_fd == KF_FD_TYPE_CWD) {
- py_path = psutil_PyUnicode_DecodeFSDefault(kif->kf_path);
+ py_path = PyUnicode_DecodeFSDefault(kif->kf_path);
if (!py_path)
goto error;
break;
@@ -567,7 +567,7 @@ psutil_proc_cwd(PyObject *self, PyObject *args) {
* as root we return an empty string instead of AccessDenied.
*/
if (py_path == NULL)
- py_path = psutil_PyUnicode_DecodeFSDefault("");
+ py_path = PyUnicode_DecodeFSDefault("");
free(freep);
return py_path;
@@ -821,7 +821,7 @@ psutil_proc_memory_maps(PyObject *self, PyObject *args) {
path = kve->kve_path;
}
- py_path = psutil_PyUnicode_DecodeFSDefault(path);
+ py_path = PyUnicode_DecodeFSDefault(path);
if (! py_path)
goto error;
py_tuple = Py_BuildValue("ssOiiii",
diff --git a/psutil/arch/bsd/freebsd_socks.c b/psutil/arch/bsd/freebsd_socks.c
index 708ff893..28695658 100644
--- a/psutil/arch/bsd/freebsd_socks.c
+++ b/psutil/arch/bsd/freebsd_socks.c
@@ -417,7 +417,7 @@ int psutil_gather_unix(int proto, PyObject *py_retlist) {
snprintf(path, sizeof(path), "%.*s",
(int)(sun->sun_len - (sizeof(*sun) - sizeof(sun->sun_path))),
sun->sun_path);
- py_lpath = psutil_PyUnicode_DecodeFSDefault(path);
+ py_lpath = PyUnicode_DecodeFSDefault(path);
if (! py_lpath)
goto error;
@@ -604,7 +604,7 @@ psutil_proc_connections(PyObject *self, PyObject *args) {
(int)(sun->sun_len - (sizeof(*sun) - sizeof(sun->sun_path))),
sun->sun_path);
- py_laddr = psutil_PyUnicode_DecodeFSDefault(path);
+ py_laddr = PyUnicode_DecodeFSDefault(path);
if (! py_laddr)
goto error;
diff --git a/psutil/arch/bsd/netbsd.c b/psutil/arch/bsd/netbsd.c
index 6a17b45e..5748000f 100644
--- a/psutil/arch/bsd/netbsd.c
+++ b/psutil/arch/bsd/netbsd.c
@@ -383,7 +383,7 @@ psutil_get_cmdline(pid_t pid) {
// separator
if (argsize > 0) {
while (pos < argsize) {
- py_arg = psutil_PyUnicode_DecodeFSDefault(&argstr[pos]);
+ py_arg = PyUnicode_DecodeFSDefault(&argstr[pos]);
if (!py_arg)
goto error;
if (PyList_Append(py_retlist, py_arg))
diff --git a/psutil/arch/bsd/netbsd_socks.c b/psutil/arch/bsd/netbsd_socks.c
index ae3ac3f1..06b7c755 100644
--- a/psutil/arch/bsd/netbsd_socks.c
+++ b/psutil/arch/bsd/netbsd_socks.c
@@ -406,10 +406,10 @@ psutil_net_connections(PyObject *self, PyObject *args) {
strcpy(laddr, sun_src->sun_path);
strcpy(raddr, sun_dst->sun_path);
status = PSUTIL_CONN_NONE;
- py_laddr = psutil_PyUnicode_DecodeFSDefault(laddr);
+ py_laddr = PyUnicode_DecodeFSDefault(laddr);
if (! py_laddr)
goto error;
- py_raddr = psutil_PyUnicode_DecodeFSDefault(raddr);
+ py_raddr = PyUnicode_DecodeFSDefault(raddr);
if (! py_raddr)
goto error;
}
diff --git a/psutil/arch/osx/process_info.c b/psutil/arch/osx/process_info.c
index ee395629..7d6861a5 100644
--- a/psutil/arch/osx/process_info.c
+++ b/psutil/arch/osx/process_info.c
@@ -177,7 +177,7 @@ psutil_get_cmdline(long pid) {
goto error;
while (arg_ptr < arg_end && nargs > 0) {
if (*arg_ptr++ == '\0') {
- py_arg = psutil_PyUnicode_DecodeFSDefault(curr_arg);
+ py_arg = PyUnicode_DecodeFSDefault(curr_arg);
if (! py_arg)
goto error;
if (PyList_Append(py_retlist, py_arg))
@@ -289,7 +289,7 @@ psutil_get_environ(long pid) {
arg_ptr = s + 1;
}
- py_ret = psutil_PyUnicode_DecodeFSDefaultAndSize(
+ py_ret = PyUnicode_DecodeFSDefaultAndSize(
procenv, arg_ptr - env_start + 1);
if (!py_ret) {
// XXX: don't want to free() this as per: