Skip to content

Commit 4cac6eb

Browse files
committed
Add a clear_env_var option on the tracer (disables tracing in subprocesses basically).
1 parent addbd8d commit 4cac6eb

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/hunter.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
import ast
44
import atexit
5-
from distutils.sysconfig import get_python_lib
65
import inspect
6+
import io
77
import linecache
88
import os
99
import pdb
1010
import re
1111
import sys
1212
import tokenize
13+
from distutils.sysconfig import get_python_lib
1314
from functools import partial
1415
from itertools import chain
1516

@@ -130,8 +131,12 @@ def trace(self, *predicates, **options):
130131
if "action" not in options and "actions" not in options:
131132
options["action"] = CodePrinter
132133
merge = options.pop("merge", True)
134+
clear_env_var = options.pop("clear_env_var", False)
133135
predicate = Q(*predicates, **options)
134136

137+
if clear_env_var:
138+
os.environ.pop("PYTHONHUNTER", None)
139+
135140
previous_tracer = sys.gettrace()
136141
if previous_tracer is self:
137142
if merge:

0 commit comments

Comments
 (0)