bpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492)
Don't access PyInterpreterState.config member directly anymore, but
use new functions:
* _PyInterpreterState_GetConfig()
* _PyInterpreterState_SetConfig()
* _Py_GetConfig()
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h
index 2709727..7052228 100644
--- a/Include/cpython/pystate.h
+++ b/Include/cpython/pystate.h
@@ -192,6 +192,13 @@
PyInterpreterState *interp,
_PyFrameEvalFunction eval_frame);
+PyAPI_FUNC(const PyConfig*) _PyInterpreterState_GetConfig(PyInterpreterState *interp);
+
+// Get the configuration of the currrent interpreter.
+// The caller must hold the GIL.
+PyAPI_FUNC(const PyConfig*) _Py_GetConfig(void);
+
+
/* cross-interpreter data */
struct _xid;
diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h
index 13a957a..c28df89 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -380,6 +380,10 @@
/* Used by _PyImport_Cleanup() */
extern void _PyInterpreterState_ClearModules(PyInterpreterState *interp);
+extern PyStatus _PyInterpreterState_SetConfig(
+ PyInterpreterState *interp,
+ const PyConfig *config);
+
PyAPI_FUNC(void) _PyGILState_Reinit(_PyRuntimeState *runtime);