summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2021-12-08 01:56:06 (GMT)
committerGitHub <noreply@github.com>2021-12-08 01:56:06 (GMT)
commit758b74e71eb22e1e83a9eb937d1c015e461745a1 (patch)
tree10eab2bb7eef9b653409593146c72f5d491f0dd3 /Modules
parent1f384e318481532323bb9076f4447bc02da07209 (diff)
downloadcpython-758b74e71eb22e1e83a9eb937d1c015e461745a1.zip
cpython-758b74e71eb22e1e83a9eb937d1c015e461745a1.tar.gz
cpython-758b74e71eb22e1e83a9eb937d1c015e461745a1.tar.bz2
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
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index b1c2914..2d95efe 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -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;
}