Skip to content

Commit cddfebd

Browse files
committed
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)
1 parent 89514fc commit cddfebd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/poetry/utils/env.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,9 @@ def run_pip(self, *args: str, **kwargs: Any) -> int | str:
14751475
return self._run(cmd, **kwargs)
14761476

14771477
def run_python_script(self, content: str, **kwargs: Any) -> int | str:
1478-
return self.run(self._executable, "-W", "ignore", "-", input_=content, **kwargs)
1478+
return self.run(
1479+
self._executable, "-I", "-W", "ignore", "-", input_=content, **kwargs
1480+
)
14791481

14801482
def _run(self, cmd: list[str], **kwargs: Any) -> int | str:
14811483
"""

0 commit comments

Comments
 (0)