bpo-36710: Add runtime variable to Py_InitializeEx() (GH-12939)

Py_InitializeEx() now uses a runtime variable passed to subfunctions,
rather than working directly on the global variable _PyRuntime.

Add 'runtime' parameter to _PyCoreConfig_Write(), _PySys_Create(),
_PySys_InitMain(), _PyGILState_Init(),
emit_stderr_warning_for_legacy_locale() and other subfunctions.
This commit is contained in:
Victor Stinner 2019-04-24 18:23:53 +02:00 committed by GitHub
parent 8e91c246e4
commit 43125224d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 104 additions and 71 deletions

View file

@ -1052,13 +1052,13 @@ PyThreadState_IsCurrent(PyThreadState *tstate)
Py_Initialize/Py_FinalizeEx
*/
void
_PyGILState_Init(PyInterpreterState *interp, PyThreadState *tstate)
_PyGILState_Init(_PyRuntimeState *runtime,
PyInterpreterState *interp, PyThreadState *tstate)
{
/* must init with valid states */
assert(interp != NULL);
assert(tstate != NULL);
_PyRuntimeState *runtime = &_PyRuntime;
struct _gilstate_runtime_state *gilstate = &runtime->gilstate;
if (PyThread_tss_create(&gilstate->autoTSSkey) != 0) {