summaryrefslogtreecommitdiff
path: root/psutil/_common.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2022-02-23 22:57:44 +0000
committerGitHub <noreply@github.com>2022-02-23 23:57:44 +0100
commit4225d799439525bea5d77935e3a73af1caf27738 (patch)
tree26ec9a080065e392d4c268d117f599c2a031e2e3 /psutil/_common.py
parentdd57b9a109d6db9a87247d5f47303b87672dfa78 (diff)
downloadpsutil-4225d799439525bea5d77935e3a73af1caf27738.tar.gz
Fixes #2078: Import the inspect module on use (#2079)
Diffstat (limited to 'psutil/_common.py')
-rw-r--r--psutil/_common.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/psutil/_common.py b/psutil/_common.py
index 00a9c6fd..ef3e8664 100644
--- a/psutil/_common.py
+++ b/psutil/_common.py
@@ -44,8 +44,6 @@ 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
_DEFAULT = object()
__all__ = [
@@ -890,6 +888,7 @@ 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):