mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-46008: Add _PyInterpreterState_Main(). (gh-29978)
PyInterpreterState_Main() is a plain function exposed in the public C-API. For internal usage we can take the more efficient approach in this PR. https://bugs.python.org/issue46008
This commit is contained in:
parent
1f384e3184
commit
758b74e71e
4 changed files with 13 additions and 9 deletions
|
@ -6696,7 +6696,7 @@ os_fork1_impl(PyObject *module)
|
|||
{
|
||||
pid_t pid;
|
||||
|
||||
if (_PyInterpreterState_GET() != PyInterpreterState_Main()) {
|
||||
if (!_Py_IsMainInterpreter(_PyInterpreterState_GET())) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "fork not supported for subinterpreters");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -7348,7 +7348,7 @@ os_forkpty_impl(PyObject *module)
|
|||
int master_fd = -1;
|
||||
pid_t pid;
|
||||
|
||||
if (_PyInterpreterState_GET() != PyInterpreterState_Main()) {
|
||||
if (!_Py_IsMainInterpreter(_PyInterpreterState_GET())) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "fork not supported for subinterpreters");
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue