diff options
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/execfile.py | 2 | ||||
-rw-r--r-- | coverage/parser.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/coverage/execfile.py b/coverage/execfile.py index f0f4f171..d26da65b 100644 --- a/coverage/execfile.py +++ b/coverage/execfile.py @@ -275,7 +275,7 @@ def make_code_from_py(filename): except (OSError, NoSource) as exc: raise NoSource(f"No file to run: '{filename}'") from exc - return compile(source, filename, "exec") + return compile(source, filename, "exec", dont_inherit=True) def make_code_from_pyc(filename): diff --git a/coverage/parser.py b/coverage/parser.py index 37d74767..b8ddb501 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -385,7 +385,7 @@ class ByteParser: else: assert filename is not None try: - self.code = compile(text, filename, "exec") + self.code = compile(text, filename, "exec", dont_inherit=True) except SyntaxError as synerr: raise NotPython( "Couldn't parse '%s' as Python source: '%s' at line %d" % ( |