Skip to content

Commit 7e3acd9

Browse files
committed
fix: check for safe_path in a safer way. #1946
1 parent 2e16f8b commit 7e3acd9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

coverage/execfile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from types import CodeType, ModuleType
1818
from typing import Any
1919

20-
from coverage import env
2120
from coverage.exceptions import CoverageException, _ExceptionDuringRun, NoCode, NoSource
2221
from coverage.files import canonical_filename, python_reported_file
2322
from coverage.misc import isolate_module
@@ -90,7 +89,7 @@ def prepare(self) -> None:
9089
This needs to happen before any importing, and without importing anything.
9190
"""
9291
path0: str | None
93-
if env.PYVERSION >= (3, 11) and getattr(sys.flags, "safe_path"):
92+
if getattr(sys.flags, "safe_path", False):
9493
# See https://docs.python.org/3/using/cmdline.html#cmdoption-P
9594
path0 = None
9695
elif self.as_module:

0 commit comments

Comments
 (0)