bpo-34170: Add _PyCoreConfig.isolated (GH-8417)

* _PyCoreConfig: add isolated and site_import attributes
* Replace Py_IgnoreEnvironment with config->ignore_environment when
  reading the current configuration
* _PyCoreConfig_Read() now sets ignore_environment, utf8_mode,
  isolated and site_import from Py_IgnoreEnvironment, Py_UTF8Mode,
  Py_IsolatedFlag and Py_NoSiteFlag
* _Py_InitializeCore() now sets Py_xxx flags from the configuration
* pymain_read_conf() now uses _PyCoreConfig_Copy() to save/restore
  the configuration.
* Rename _disable_importlib of _PyCoreConfig to _install_importlib
* _PyCoreConfig_SetGlobalConfig() now also set
  Py_HashRandomizationFlag
* Replace !Py_NoSiteFlag with core_config->site_import
This commit is contained in:
Victor Stinner 2018-07-24 13:55:48 +02:00 committed by GitHub
parent ac0b3c2f4d
commit d19d8d5279
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 411 additions and 353 deletions

View file

@ -563,7 +563,7 @@ read_pth_file(_PyPathConfig *config, wchar_t *prefix, const wchar_t *path)
wcscpy_s(prefix, MAXPATHLEN+1, path);
reduce(prefix);
config->isolated = 1;
config->no_site_import = 1;
config->site_import = 0;
size_t bufsiz = MAXPATHLEN;
size_t prefixlen = wcslen(prefix);
@ -588,7 +588,7 @@ read_pth_file(_PyPathConfig *config, wchar_t *prefix, const wchar_t *path)
}
if (strcmp(line, "import site") == 0) {
config->no_site_import = 0;
config->site_import = 1;
continue;
}
else if (strncmp(line, "import ", 7) == 0) {