diff options
-rw-r--r-- | psutil/_psutil_linux.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/psutil/_psutil_linux.c b/psutil/_psutil_linux.c index f04fe776..924fe702 100644 --- a/psutil/_psutil_linux.c +++ b/psutil/_psutil_linux.c @@ -314,7 +314,14 @@ psutil_proc_cpu_affinity_set(PyObject *self, PyObject *args) { return NULL; if (!PySequence_Check(py_cpu_set)) { - return PyErr_Format(PyExc_TypeError, "sequence argument expected, got %R", Py_TYPE(py_cpu_set)); + return PyErr_Format( + PyExc_TypeError, +#if PY_MAJOR_VERSION >= 3 + "sequence argument expected, got %R", Py_TYPE(py_cpu_set) +#else + "sequence argument expected, got %s", Py_TYPE(py_cpu_set)->tp_name +#endif + ); } seq_len = PySequence_Size(py_cpu_set); |