FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-129204: Add _PYTHON_SUBPROCESS_USE_POSIX_SPAWN environment knob by vfazio · Pull Request #132184 · python/cpython · GitHub

/ cpython Public

gh-129204: Add _PYTHON_SUBPROCESS_USE_POSIX_SPAWN environment knob - #132184

Merged
gpshead merged 2 commits into
python:mainfrom
vfazio:vfazio-posix_spawn_envvar
Apr 7, 2025
Merged

gh-129204: Add _PYTHON_SUBPROCESS_USE_POSIX_SPAWN environment knob#132184
gpshead merged 2 commits into
python:mainfrom
vfazio:vfazio-posix_spawn_envvar

Conversation

vfazio commented Apr 7, 2025
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Add support for disabling the use of posix_spawn via a variable in the process environment.

While it was previously possible to toggle this by modifying the value of subprocess._USE_POSIX_SPAWN, this required either patching CPython or modifying it within the interpreter instance which is not always possible, such as when running applications or scripts not under a user's control.

Add support for disabling the use of `posix_spawn` via a variable in
the process environment.

While it was previously possible to toggle this by modifying the value
of `subprocess._USE_POSIX_SPAWN`, this required either patching CPython
or modifying it within the interpreter instance which is not always
possible, such as when running applications or scripts not under a
user's control.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>

vfazio commented Apr 7, 2025

Copy link
Copy Markdown
Contributor Author
vfazio@Zephyrus:~/development/cpython$ _PYTHON_SUBPROCESS_USE_POSIX_SPAWN="0" ./python -c "import subprocess; print(subprocess._USE_POSIX_SPAWN)"
False
vfazio@Zephyrus:~/development/cpython$ _PYTHON_SUBPROCESS_USE_POSIX_SPAWN=0 ./python -c "import subprocess; print(subprocess._USE_POSIX_SPAWN)"
False
vfazio@Zephyrus:~/development/cpython$ _PYTHON_SUBPROCESS_USE_POSIX_SPAWN=1 ./python -c "import subprocess; print(subprocess._USE_POSIX_SPAWN)"
True
vfazio@Zephyrus:~/development/cpython$ _PYTHON_SUBPROCESS_USE_POSIX_SPAWN="" ./python -c "import subprocess; print(subprocess._USE_POSIX_SPAWN)"
True

@gpshead per our discussion in #129204 (comment)

gpshead merged commit 4c5dcc6 into python:main Apr 7, 2025
gpshead added the needs backport to 3.13 bugs and security fixes label Apr 7, 2025

Copy link
Copy Markdown

Thanks @vfazio for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 7, 2025
…nob (pythonGH-132184)

* Add _PYTHON_SUBPROCESS_USE_POSIX_SPAWN environment knob

Add support for disabling the use of `posix_spawn` via a variable in
the process environment.

While it was previously possible to toggle this by modifying the value
of `subprocess._USE_POSIX_SPAWN`, this required either patching CPython
or modifying it within the interpreter instance which is not always
possible, such as when running applications or scripts not under a
user's control.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>

* fixup NEWS entry

---------
(cherry picked from commit 4c5dcc6)

Co-authored-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Vincent Fazio <vfazio@gmail.com>

bedevere-app Bot commented Apr 7, 2025

Copy link
Copy Markdown

GH-132191 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Apr 7, 2025
gpshead pushed a commit that referenced this pull request Apr 7, 2025
…knob (GH-132184) (#132191)

gh-129204: Add _PYTHON_SUBPROCESS_USE_POSIX_SPAWN environment knob (GH-132184)

* Add _PYTHON_SUBPROCESS_USE_POSIX_SPAWN environment knob

Add support for disabling the use of `posix_spawn` via a variable in
the process environment.

While it was previously possible to toggle this by modifying the value
of `subprocess._USE_POSIX_SPAWN`, this required either patching CPython
or modifying it within the interpreter instance which is not always
possible, such as when running applications or scripts not under a
user's control.



* fixup NEWS entry

---------
(cherry picked from commit 4c5dcc6)

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Co-authored-by: Vincent Fazio <vfazio@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL