Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static void call_ll_exitfuncs(void);

int _Py_UnhandledKeyboardInterrupt = 0;
_PyRuntimeState _PyRuntime = _PyRuntimeState_INIT;
static int runtime_initialized = 0;

_PyInitError
_PyRuntime_Initialize(void)
Expand All @@ -79,11 +80,10 @@ _PyRuntime_Initialize(void)
every Py_Initialize() call, but doing so breaks the runtime.
This is because the runtime state is not properly finalized
currently. */
static int initialized = 0;
if (initialized) {
if (runtime_initialized) {
return _Py_INIT_OK();
}
initialized = 1;
runtime_initialized = 1;

return _PyRuntimeState_Init(&_PyRuntime);
}
Expand All @@ -92,6 +92,7 @@ void
_PyRuntime_Finalize(void)
{
_PyRuntimeState_Fini(&_PyRuntime);
runtime_initialized = 0;
}

int
Expand Down