From b01d965e2994e403afffbbdbc4e50e814b784a0e Mon Sep 17 00:00:00 2001 From: Ilya Yanok Date: Mon, 27 Aug 2018 18:26:25 +0200 Subject: [PATCH] make psutil_debug() aware of PSUTIL_DEBUG Fixes #1331 --- psutil/_psutil_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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); + } }