summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-13 17:15:33 (GMT)
committerGitHub <noreply@github.com>2020-03-13 17:15:33 (GMT)
commitbe79373a78c0d75fc715ab64253c9b757987a848 (patch)
tree9fba5caff3547b80fbfd2b468339458e7d5d0037 /Modules
parentff4584caca04cb3da0dbd5b1e9bf67e40adf5312 (diff)
downloadcpython-be79373a78c0d75fc715ab64253c9b757987a848.zip
cpython-be79373a78c0d75fc715ab64253c9b757987a848.tar.gz
cpython-be79373a78c0d75fc715ab64253c9b757987a848.tar.bz2
bpo-39947: Add PyInterpreterState_Get() function (GH-18979)
* Rename _PyInterpreterState_Get() to PyInterpreterState_Get() and move it the limited C API. * Add _PyInterpreterState_Get() alias to PyInterpreterState_Get() for backward compatibility with Python 3.8.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_posixsubprocess.c2
-rw-r--r--Modules/_xxsubinterpretersmodule.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c
index 2aed79e..f9919c3 100644
--- a/Modules/_posixsubprocess.c
+++ b/Modules/_posixsubprocess.c
@@ -635,7 +635,7 @@ subprocess_fork_exec(PyObject* self, PyObject *args)
return NULL;
if ((preexec_fn != Py_None) &&
- (_PyInterpreterState_Get() != PyInterpreterState_Main())) {
+ (PyInterpreterState_Get() != PyInterpreterState_Main())) {
PyErr_SetString(PyExc_RuntimeError,
"preexec_fn not supported within subinterpreters");
return NULL;
diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
index cc4f5d9..526115a 100644
--- a/Modules/_xxsubinterpretersmodule.c
+++ b/Modules/_xxsubinterpretersmodule.c
@@ -26,9 +26,9 @@ _copy_raw_string(PyObject *strobj)
static PyInterpreterState *
_get_current(void)
{
- // _PyInterpreterState_Get() aborts if lookup fails, so don't need
+ // PyInterpreterState_Get() aborts if lookup fails, so don't need
// to check the result for NULL.
- return _PyInterpreterState_Get();
+ return PyInterpreterState_Get();
}
@@ -1928,7 +1928,7 @@ _run_script_in_interpreter(PyInterpreterState *interp, const char *codestr,
// Switch to interpreter.
PyThreadState *save_tstate = NULL;
- if (interp != _PyInterpreterState_Get()) {
+ if (interp != PyInterpreterState_Get()) {
// XXX Using the "head" thread isn't strictly correct.
PyThreadState *tstate = PyInterpreterState_ThreadHead(interp);
// XXX Possible GILState issues?