diff --git a/psutil/_psutil_common.c b/psutil/_psutil_common.c index 49b91c826..db1a04601 100644 --- a/psutil/_psutil_common.c +++ b/psutil/_psutil_common.c @@ -84,11 +84,13 @@ psutil_set_testing(PyObject *self, PyObject *args) { void psutil_debug(const char* format, ...) { va_list argptr; - va_start(argptr, format); - fprintf(stderr, "psutil-debug> "); - vfprintf(stderr, format, argptr); - fprintf(stderr, "\n"); - va_end(argptr); + if (PSUTIL_DEBUG) { + va_start(argptr, format); + fprintf(stderr, "psutil-debug> "); + vfprintf(stderr, format, argptr); + fprintf(stderr, "\n"); + va_end(argptr); + } }