summaryrefslogtreecommitdiff
path: root/psutil/_common.py
diff options
context:
space:
mode:
Diffstat (limited to 'psutil/_common.py')
-rw-r--r--psutil/_common.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/psutil/_common.py b/psutil/_common.py
index 16d3b3b5..bec8333f 100644
--- a/psutil/_common.py
+++ b/psutil/_common.py
@@ -44,6 +44,8 @@ else:
# can't take it from _common.py as this script is imported by setup.py
PY3 = sys.version_info[0] == 3
PSUTIL_DEBUG = bool(os.getenv('PSUTIL_DEBUG', 0))
+if PSUTIL_DEBUG:
+ import inspect
__all__ = [
# OS constants
@@ -835,7 +837,6 @@ def print_color(
def debug(msg):
"""If PSUTIL_DEBUG env var is set, print a debug message to stderr."""
if PSUTIL_DEBUG:
- import inspect
fname, lineno, func_name, lines, index = inspect.getframeinfo(
inspect.currentframe().f_back)
if isinstance(msg, Exception):