Skip to content

Commit ba28b37

Browse files
committed
Address review: use wrapper functions instead of low-level accessors
Use _Py_IsCoreInitialized() in preconfig.c and Py_IsInitialized() in Py_InitializeEx(), removing the unnecessary runtime local variable. Thanks picnixz!
1 parent 2e3aa7e commit ba28b37

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Python/preconfig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ _PyPreConfig_Write(const PyPreConfig *src_config)
928928
return status;
929929
}
930930

931-
if (_PyRuntimeState_GetCoreInitialized(&_PyRuntime)) {
931+
if (_Py_IsCoreInitialized()) {
932932
/* bpo-34008: Calling this functions after Py_Initialize() ignores
933933
the new configuration. */
934934
return _PyStatus_OK();

Python/pylifecycle.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,9 +1505,8 @@ Py_InitializeEx(int install_sigs)
15051505
if (_PyStatus_EXCEPTION(status)) {
15061506
Py_ExitStatusException(status);
15071507
}
1508-
_PyRuntimeState *runtime = &_PyRuntime;
15091508

1510-
if (_PyRuntimeState_GetInitialized(runtime)) {
1509+
if (Py_IsInitialized()) {
15111510
/* bpo-33932: Calling Py_Initialize() twice does nothing. */
15121511
return;
15131512
}

0 commit comments

Comments
 (0)