Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
98d90f74
Commit
98d90f74
authored
Aug 27, 2019
by
Christian Heimes
Committed by
GitHub
Aug 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-37951: Lift subprocess's fork() restriction (GH-15544)
parent
3224e1a6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
2 deletions
+19
-2
Doc/library/subprocess.rst
Doc/library/subprocess.rst
+7
-0
Doc/whatsnew/3.8.rst
Doc/whatsnew/3.8.rst
+6
-0
Misc/NEWS.d/next/Library/2019-08-27-10-03-48.bpo-37951.MfRQgL.rst
...S.d/next/Library/2019-08-27-10-03-48.bpo-37951.MfRQgL.rst
+2
-0
Modules/_posixsubprocess.c
Modules/_posixsubprocess.c
+4
-2
No files found.
Doc/library/subprocess.rst
View file @
98d90f74
...
@@ -483,6 +483,13 @@ functions.
...
@@ -483,6 +483,13 @@ functions.
The *start_new_session* parameter can take the place of a previously
The *start_new_session* parameter can take the place of a previously
common use of *preexec_fn* to call os.setsid() in the child.
common use of *preexec_fn* to call os.setsid() in the child.
.. versionchanged:: 3.8
The *preexec_fn* parameter is no longer supported in subinterpreters.
The use of the parameter in a subinterpreter raises
:exc:`RuntimeError`. The new restriction may affect applications that
are deployed in mod_wsgi, uWSGI, and other embedded environments.
If *close_fds* is true, all file descriptors except :const:`0`, :const:`1` and
If *close_fds* is true, all file descriptors except :const:`0`, :const:`1` and
:const:`2` will be closed before the child process is executed. Otherwise
:const:`2` will be closed before the child process is executed. Otherwise
when *close_fds* is false, file descriptors obey their inheritable flag
when *close_fds* is false, file descriptors obey their inheritable flag
...
...
Doc/whatsnew/3.8.rst
View file @
98d90f74
...
@@ -1531,6 +1531,12 @@ Changes in the Python API
...
@@ -1531,6 +1531,12 @@ Changes in the Python API
non-zero :attr:`~Popen.returncode`.
non-zero :attr:`~Popen.returncode`.
(Contributed by Joannah Nanjekye and Victor Stinner in :issue:`35537`.)
(Contributed by Joannah Nanjekye and Victor Stinner in :issue:`35537`.)
* The *preexec_fn* argument of * :class:`subprocess.Popen` is no longer
compatible with subinterpreters. The use of the parameter in a
subinterpreter now raises :exc:`RuntimeError`.
(Contributed by Eric Snow in :issue:`34651`, modified by Christian Heimes
in :issue:`37951`.)
* The :meth:`imap.IMAP4.logout` method no longer ignores silently arbitrary
* The :meth:`imap.IMAP4.logout` method no longer ignores silently arbitrary
exceptions.
exceptions.
...
...
Misc/NEWS.d/next/Library/2019-08-27-10-03-48.bpo-37951.MfRQgL.rst
0 → 100644
View file @
98d90f74
Most features of the subprocess module now work again in subinterpreters.
Only *preexec_fn* is restricted in subinterpreters.
Modules/_posixsubprocess.c
View file @
98d90f74
...
@@ -583,8 +583,10 @@ subprocess_fork_exec(PyObject* self, PyObject *args)
...
@@ -583,8 +583,10 @@ subprocess_fork_exec(PyObject* self, PyObject *args)
&
restore_signals
,
&
call_setsid
,
&
preexec_fn
))
&
restore_signals
,
&
call_setsid
,
&
preexec_fn
))
return
NULL
;
return
NULL
;
if
(
_PyInterpreterState_Get
()
!=
PyInterpreterState_Main
())
{
if
((
preexec_fn
!=
Py_None
)
&&
PyErr_SetString
(
PyExc_RuntimeError
,
"fork not supported for subinterpreters"
);
(
_PyInterpreterState_Get
()
!=
PyInterpreterState_Main
()))
{
PyErr_SetString
(
PyExc_RuntimeError
,
"preexec_fn not supported within subinterpreters"
);
return
NULL
;
return
NULL
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment