From cddfebd11144fd8f0a5b1f5540d9807f85ab17dd Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Mon, 26 Sep 2022 00:26:15 -0600 Subject: [PATCH] fix(env): run Python inside environments in isolated mode this avoids issues when `PYTHON*` environmental variables are set, and prevents the CWD from being added to `sys.path` (and thus clobbering stdlib names) --- src/poetry/utils/env.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/poetry/utils/env.py b/src/poetry/utils/env.py index 8d9f91ba6c9..562c7751b14 100644 --- a/src/poetry/utils/env.py +++ b/src/poetry/utils/env.py @@ -1475,7 +1475,9 @@ def run_pip(self, *args: str, **kwargs: Any) -> int | str: return self._run(cmd, **kwargs) def run_python_script(self, content: str, **kwargs: Any) -> int | str: - return self.run(self._executable, "-W", "ignore", "-", input_=content, **kwargs) + return self.run( + self._executable, "-I", "-W", "ignore", "-", input_=content, **kwargs + ) def _run(self, cmd: list[str], **kwargs: Any) -> int | str: """