gh-129033: Remove _PyInterpreterState_SetConfig() function (#129048)

Remove _PyInterpreterState_GetConfigCopy() and
_PyInterpreterState_SetConfig() private functions. PEP 741 "Python
Configuration C API" added a better public C API: PyConfig_Get() and
PyConfig_Set().
This commit is contained in:
Victor Stinner 2025-01-20 16:31:33 +01:00 committed by GitHub
parent 573c181502
commit 8ceb6cb117
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 22 additions and 500 deletions

View file

@ -1791,48 +1791,6 @@ static int test_init_warnoptions(void)
}
static int tune_config(void)
{
PyConfig config;
PyConfig_InitPythonConfig(&config);
if (_PyInterpreterState_GetConfigCopy(&config) < 0) {
PyConfig_Clear(&config);
PyErr_Print();
return -1;
}
config.bytes_warning = 2;
if (_PyInterpreterState_SetConfig(&config) < 0) {
PyConfig_Clear(&config);
return -1;
}
PyConfig_Clear(&config);
return 0;
}
static int test_init_set_config(void)
{
// Initialize core
PyConfig config;
PyConfig_InitIsolatedConfig(&config);
config_set_string(&config, &config.program_name, PROGRAM_NAME);
config.bytes_warning = 0;
init_from_config_clear(&config);
// Tune the configuration using _PyInterpreterState_SetConfig()
if (tune_config() < 0) {
PyErr_Print();
return 1;
}
dump_config();
Py_Finalize();
return 0;
}
static int initconfig_getint(PyInitConfig *config, const char *name)
{
int64_t value;
@ -2445,7 +2403,6 @@ static struct TestCase TestCases[] = {
{"test_init_setpythonhome", test_init_setpythonhome},
{"test_init_is_python_build", test_init_is_python_build},
{"test_init_warnoptions", test_init_warnoptions},
{"test_init_set_config", test_init_set_config},
{"test_initconfig_api", test_initconfig_api},
{"test_initconfig_get_api", test_initconfig_get_api},
{"test_initconfig_exit", test_initconfig_exit},