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.
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h
index fbb0899..96df0d9 100644
--- a/Include/cpython/pystate.h
+++ b/Include/cpython/pystate.h
@@ -139,13 +139,8 @@
};
-/* Get the current interpreter state.
-
- Issue a fatal error if there no current Python thread state or no current
- interpreter. It cannot return NULL.
-
- The caller must hold the GIL.*/
-PyAPI_FUNC(PyInterpreterState *) _PyInterpreterState_Get(void);
+// Alias for backward compatibility with Python 3.8
+#define _PyInterpreterState_Get PyInterpreterState_Get
PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *);