bpo-34170: _PyCoreConfig_Read() leaves Py_IsolatedFlag unchanged by vstinner · Pull Request #8361 · python/cpython
static int read_pth_file(_PyPathConfig *config, wchar_t *prefix, const wchar_t *path, int *isolated, int *nosite) read_pth_file(_PyPathConfig *config, wchar_t *prefix, const wchar_t *path) { FILE *sp_file = _Py_wfopen(path, L"r"); if (sp_file == NULL) {
wcscpy_s(prefix, MAXPATHLEN+1, path); reduce(prefix); *isolated = 1; *nosite = 1; config->isolated = 1; config->no_site_import = 1;
size_t bufsiz = MAXPATHLEN; size_t prefixlen = wcslen(prefix);
if (strcmp(line, "import site") == 0) { *nosite = 0; config->no_site_import = 0; continue; } else if (strncmp(line, "import ", 7) == 0) { } else if (strncmp(line, "import ", 7) == 0) { Py_FatalError("only 'import site' is supported in ._pth file"); }
/* FIXME, bpo-32030: Global configuration variables should not be modified here, _PyPathConfig_Init() is called early in Python initialization: see pymain_cmdline(). */ return read_pth_file(config, prefix, spbuffer, &Py_IsolatedFlag, &Py_NoSiteFlag); return read_pth_file(config, prefix, spbuffer); }