summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-11-12 02:37:58 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2017-11-12 02:37:58 +0100
commitca73eebc911ebfb3db0f1bcc9305d3270524519d (patch)
tree7f8cef5f9dc2be2834e3246c47b0e7d6ddb8ea3c
parentc11c6ab12886283200b0ae5897d12fe64255a824 (diff)
downloadpsutil-ca73eebc911ebfb3db0f1bcc9305d3270524519d.tar.gz
move PyUnicode compt fun definition up in the file
-rw-r--r--psutil/_psutil_common.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/psutil/_psutil_common.c b/psutil/_psutil_common.c
index 499925cd..7a2665d7 100644
--- a/psutil/_psutil_common.c
+++ b/psutil/_psutil_common.c
@@ -9,6 +9,27 @@
#include <Python.h>
#include <stdio.h>
+
+/*
+ * Backport of unicode FS APIs from Python 3.
+ * On Python 2 we just return a plain byte string
+ * which is never supposed to raise decoding errors.
+ * See: https://github.com/giampaolo/psutil/issues/1040
+ */
+#if PY_MAJOR_VERSION < 3
+PyObject *
+PyUnicode_DecodeFSDefault(char *s) {
+ return PyString_FromString(s);
+}
+
+
+PyObject *
+PyUnicode_DecodeFSDefaultAndSize(char *s, Py_ssize_t size) {
+ return PyString_FromStringAndSize(s, size);
+}
+#endif
+
+
/*
* Set OSError(errno=ESRCH, strerror="No such process") Python exception.
*/
@@ -67,23 +88,3 @@ psutil_set_testing(PyObject *self, PyObject *args) {
Py_INCREF(Py_None);
return Py_None;
}
-
-
-/*
- * Backport of unicode FS APIs from Python 3.
- * On Python 2 we just return a plain byte string
- * which is never supposed to raise decoding errors.
- * See: https://github.com/giampaolo/psutil/issues/1040
- */
-#if PY_MAJOR_VERSION < 3
-PyObject *
-PyUnicode_DecodeFSDefault(char *s) {
- return PyString_FromString(s);
-}
-
-
-PyObject *
-PyUnicode_DecodeFSDefaultAndSize(char *s, Py_ssize_t size) {
- return PyString_FromStringAndSize(s, size);
-}
-#endif