Skip to content

Commit

Permalink
fix(env): run Python inside environments in isolated mode
Browse files Browse the repository at this point in the history
this avoids issues when `PYTHON*` environmental variables are set, and
prevents the CWD from being added to `sys.path` (and thus clobbering
stdlib names)
  • Loading branch information
neersighted committed Sep 27, 2022
1 parent cf3dcad commit 4746b3d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down

0 comments on commit 4746b3d

Please sign in to comment.