-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-37951: Lift subprocess's fork() restriction (GH-15544) #15544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-37951: Lift subprocess's fork() restriction (GH-15544) #15544
Conversation
Signed-off-by: Christian Heimes <christian@python.org>
b76ff65
to
c91ab6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Valid approach according to https://bugs.python.org/issue34651#msg325302
I just added a minor comment.
Doc/library/subprocess.rst
Outdated
|
||
The *preexec_fn* parameter is no longer supported in subinterpreters. | ||
The new restriction may affect applications that are deployed in | ||
mod_wsgi, uWSGI, and other environments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that it's useful to document affected applications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list of affected applications makes it easier for affected users to find the culprit. In my experience it's mostly embedded WSGI servers and embedded applications that use subinterpreters. mod_wsgi and uWSGI are the most common ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you say "no longer supported", here and in whatsnew, mention that use of it raises a RuntimeError.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I do agree that most users probably are not aware that they're in a subinterpreter, so listing some common examples of such environments is not a bad thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gpshead The subinterpreter and whatsnew entries now mention RuntimeError.
I'll wait for ACK from either @gpshead or @ericsnowcurrently before I push the fix. |
Modules/_posixsubprocess.c
Outdated
PyErr_SetString(PyExc_RuntimeError, "fork not supported for subinterpreters"); | ||
if ((preexec_fn != Py_None) && | ||
(_PyInterpreterState_Get() != PyInterpreterState_Main())) { | ||
PyErr_SetString(PyExc_RuntimeError, "preexec_fn not supported for subinterpreters"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/for/within/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that makes sense. ETOOLAZY
@gpshead Please review again |
Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
I'm having trouble backporting to |
Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
GH-15554 is a backport of this pull request to the 3.8 branch. |
(cherry picked from commit 98d90f7) Co-authored-by: Christian Heimes <christian@python.org>
It will be in b4, yes. 8000 |
Signed-off-by: Christian Heimes christian@python.org
https://bugs.python.org/issue37951