mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-40910: Export Py_GetArgcArgv() function (GH-20721)
Export explicitly the Py_GetArgcArgv() function to the C API and document the function. Previously, it was exported implicitly which no longer works since Python is built with -fvisibility=hidden. * Add PyConfig._orig_argv member. * Py_InitializeFromConfig() no longer calls _PyConfig_Write() twice. * PyConfig_Read() no longer initializes Py_GetArgcArgv(): it is now _PyConfig_Write() responsibility. * _PyConfig_Write() result type becomes PyStatus instead of void. * Write an unit test on Py_GetArgcArgv().
This commit is contained in:
parent
8f023a2f66
commit
e81f6e687d
10 changed files with 131 additions and 22 deletions
|
@ -460,7 +460,10 @@ pyinit_core_reconfigure(_PyRuntimeState *runtime,
|
|||
return _PyStatus_ERR("can't make main interpreter");
|
||||
}
|
||||
|
||||
_PyConfig_Write(config, runtime);
|
||||
status = _PyConfig_Write(config, runtime);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _PyInterpreterState_SetConfig(interp, config);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
|
@ -486,7 +489,10 @@ pycore_init_runtime(_PyRuntimeState *runtime,
|
|||
return _PyStatus_ERR("main interpreter already initialized");
|
||||
}
|
||||
|
||||
_PyConfig_Write(config, runtime);
|
||||
PyStatus status = _PyConfig_Write(config, runtime);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Py_Finalize leaves _Py_Finalizing set in order to help daemon
|
||||
* threads behave a little more gracefully at interpreter shutdown.
|
||||
|
@ -499,7 +505,7 @@ pycore_init_runtime(_PyRuntimeState *runtime,
|
|||
*/
|
||||
_PyRuntimeState_SetFinalizing(runtime, NULL);
|
||||
|
||||
PyStatus status = _Py_HashRandomization_Init(config);
|
||||
status = _Py_HashRandomization_Init(config);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
|
@ -746,8 +752,6 @@ pyinit_config(_PyRuntimeState *runtime,
|
|||
PyThreadState **tstate_p,
|
||||
const PyConfig *config)
|
||||
{
|
||||
_PyConfig_Write(config, runtime);
|
||||
|
||||
PyStatus status = pycore_init_runtime(runtime, config);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue