bpo-36142: Add _PyPreConfig structure (GH-12172)

* Add _PyPreConfig structure
* Move 'ignored' and 'use_environment' fields from _PyCoreConfig
  to _PyPreConfig
* Add a new "_PyPreConfig preconfig;" field to _PyCoreConfig
This commit is contained in:
Victor Stinner
2019-03-05 02:01:27 +01:00
committed by GitHub
parent 7e9ce4c89e
commit cad1f747da
9 changed files with 193 additions and 52 deletions

View File

@@ -77,9 +77,9 @@ main(int argc, char *argv[])
text[text_size] = '\0';
_PyCoreConfig config = _PyCoreConfig_INIT;
config.preconfig.use_environment = 0;
config.user_site_directory = 0;
config.site_import = 0;
config.use_environment = 0;
config.program_name = L"./_freeze_importlib";
/* Don't install importlib, since it could execute outdated bytecode. */
config._install_importlib = 0;

View File

@@ -606,15 +606,15 @@ static int test_init_isolated(void)
/* Test _PyCoreConfig.isolated=1 */
_PyCoreConfig config = _PyCoreConfig_INIT;
Py_IsolatedFlag = 0;
config.preconfig.isolated = 1;
/* Set coerce_c_locale and utf8_mode to not depend on the locale */
config.coerce_c_locale = 0;
config.utf8_mode = 0;
/* Use path starting with "./" avoids a search along the PATH */
config.program_name = L"./_testembed";
Py_IsolatedFlag = 0;
config.isolated = 1;
test_init_env_putenvs();
_PyInitError err = _Py_InitializeFromConfig(&config);
if (_Py_INIT_FAILED(err)) {