Skip to content

Commit

Permalink
[3.9] gh-90355: Add isolated flag if currently isolated (GH-92857) (G…
Browse files Browse the repository at this point in the history
…H-94570)

Co-authored-by: Carter Dodd <carter.dodd@gmail.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit c8556bc)
  • Loading branch information
ambv committed Jul 5, 2022
1 parent 224cd0c commit eff4aa5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Lib/ensurepip/__init__.py
Expand Up @@ -31,7 +31,12 @@ def _run_pip(args, additional_paths=None):
sys.argv[1:] = {args}
runpy.run_module("pip", run_name="__main__", alter_sys=True)
"""
return subprocess.run([sys.executable, "-c", code], check=True).returncode

cmd = [sys.executable, '-c', code]
if sys.flags.isolated:
# run code in isolated mode if currently running isolated
cmd.insert(1, '-I')
return subprocess.run(cmd, check=True).returncode


def version():
Expand Down
@@ -0,0 +1 @@
Fix :mod:`ensurepip` environment isolation for subprocess running ``pip``.

0 comments on commit eff4aa5

Please sign in to comment.