summaryrefslogtreecommitdiff
path: root/lab
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2023-01-09 17:42:53 -0500
committerNed Batchelder <ned@nedbatchelder.com>2023-01-09 19:00:40 -0500
commit880a64afd24aae34eff2781f568d8ac9807d2ecc (patch)
tree802cf3368d4d7a1b27ee6b5d614c367ac691e320 /lab
parent8fef6f057c377879720c4c9d994e9651362a49b9 (diff)
downloadpython-coveragepy-git-880a64afd24aae34eff2781f568d8ac9807d2ecc.tar.gz
fix: isolate user code from coverage.py internal code flags. #1524
Diffstat (limited to 'lab')
-rw-r--r--lab/genpy.py2
-rw-r--r--lab/parser.py2
-rw-r--r--lab/show_pyc.py2
3 files changed, 3 insertions, 3 deletions
diff --git a/lab/genpy.py b/lab/genpy.py
index f968c916..f88e70ca 100644
--- a/lab/genpy.py
+++ b/lab/genpy.py
@@ -231,7 +231,7 @@ def show_a_bunch():
source = PythonSpinner.generate_python(maker.make_body("def"))
try:
print("-"*80, "\n", source, sep="")
- compile(source, "<string>", "exec")
+ compile(source, "<string>", "exec", dont_inherit=True)
except Exception as ex:
print(f"Oops: {ex}\n{source}")
if len(source) > len(longest):
diff --git a/lab/parser.py b/lab/parser.py
index ebd4e7f3..c7687bda 100644
--- a/lab/parser.py
+++ b/lab/parser.py
@@ -177,7 +177,7 @@ def all_code_objects(code):
def disassemble(pyparser):
"""Disassemble code, for ad-hoc experimenting."""
- code = compile(pyparser.text, "", "exec")
+ code = compile(pyparser.text, "", "exec", dont_inherit=True)
for code_obj in all_code_objects(code):
if pyparser.text:
srclines = pyparser.text.splitlines()
diff --git a/lab/show_pyc.py b/lab/show_pyc.py
index e346930a..1bd98ec6 100644
--- a/lab/show_pyc.py
+++ b/lab/show_pyc.py
@@ -48,7 +48,7 @@ def show_py_file(fname):
show_py_text(text, fname=fname)
def show_py_text(text, fname="<string>"):
- code = compile(text, fname, "exec")
+ code = compile(text, fname, "exec", dont_inherit=True)
show_code(code)
CO_FLAGS = [