bpo-36301: Remove _PyCoreConfig.preconfig (GH-12546)

* Replace _PyCoreConfig.preconfig with 3 new fields in _PyCoreConfig:
  isolated, use_environment, dev_mode.
* Add _PyPreCmdline.dev_mode.
* Add _Py_PreInitializeFromPreConfigInPlace().
This commit is contained in:
Victor Stinner 2019-03-26 02:31:11 +01:00 committed by GitHub
parent f78a5e9ce8
commit 20004959d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 179 additions and 145 deletions

View file

@ -2158,6 +2158,7 @@ make_flags(void)
{
int pos = 0;
PyObject *seq;
const _PyPreConfig *preconfig = &_PyRuntime.preconfig;
const _PyCoreConfig *config = &_PyInterpreterState_GET_UNSAFE()->core_config;
seq = PyStructSequence_New(&FlagsType);
@ -2174,16 +2175,16 @@ make_flags(void)
SetFlag(!config->write_bytecode);
SetFlag(!config->user_site_directory);
SetFlag(!config->site_import);
SetFlag(!config->preconfig.use_environment);
SetFlag(!config->use_environment);
SetFlag(config->verbose);
/* SetFlag(saw_unbuffered_flag); */
/* SetFlag(skipfirstline); */
SetFlag(config->bytes_warning);
SetFlag(config->quiet);
SetFlag(config->use_hash_seed == 0 || config->hash_seed != 0);
SetFlag(config->preconfig.isolated);
PyStructSequence_SET_ITEM(seq, pos++, PyBool_FromLong(config->preconfig.dev_mode));
SetFlag(config->preconfig.utf8_mode);
SetFlag(config->isolated);
PyStructSequence_SET_ITEM(seq, pos++, PyBool_FromLong(config->dev_mode));
SetFlag(preconfig->utf8_mode);
#undef SetFlag
if (PyErr_Occurred()) {