bpo-34170: _PyCoreConfig_Read() leaves Py_IsolatedFlag unchanged (GH-… · python/cpython@f2626ce (original) (raw)

`@@ -553,8 +553,7 @@ get_program_full_path(const _PyCoreConfig *core_config,

`

553

553

``

554

554

``

555

555

`static int

`

556

``

`-

read_pth_file(_PyPathConfig *config, wchar_t *prefix, const wchar_t *path,

`

557

``

`-

int *isolated, int *nosite)

`

``

556

`+

read_pth_file(_PyPathConfig *config, wchar_t *prefix, const wchar_t *path)

`

558

557

`{

`

559

558

`FILE *sp_file = _Py_wfopen(path, L"r");

`

560

559

`if (sp_file == NULL) {

`

`@@ -563,8 +562,8 @@ read_pth_file(_PyPathConfig *config, wchar_t *prefix, const wchar_t *path,

`

563

562

``

564

563

`wcscpy_s(prefix, MAXPATHLEN+1, path);

`

565

564

`reduce(prefix);

`

566

``

`-

*isolated = 1;

`

567

``

`-

*nosite = 1;

`

``

565

`+

config->isolated = 1;

`

``

566

`+

config->no_site_import = 1;

`

568

567

``

569

568

`size_t bufsiz = MAXPATHLEN;

`

570

569

`size_t prefixlen = wcslen(prefix);

`

`@@ -589,9 +588,10 @@ read_pth_file(_PyPathConfig *config, wchar_t *prefix, const wchar_t *path,

`

589

588

` }

`

590

589

``

591

590

`if (strcmp(line, "import site") == 0) {

`

592

``

`-

*nosite = 0;

`

``

591

`+

config->no_site_import = 0;

`

593

592

`continue;

`

594

``

`-

} else if (strncmp(line, "import ", 7) == 0) {

`

``

593

`+

}

`

``

594

`+

else if (strncmp(line, "import ", 7) == 0) {

`

595

595

`Py_FatalError("only 'import site' is supported in ._pth file");

`

596

596

` }

`

597

597

``

`@@ -680,11 +680,7 @@ calculate_pth_file(_PyPathConfig *config, wchar_t *prefix)

`

680

680

`return 0;

`

681

681

` }

`

682

682

``

683

``

`-

/* FIXME, bpo-32030: Global configuration variables should not be modified

`

684

``

`-

here, _PyPathConfig_Init() is called early in Python initialization:

`

685

``

`-

see pymain_cmdline(). */

`

686

``

`-

return read_pth_file(config, prefix, spbuffer,

`

687

``

`-

&Py_IsolatedFlag, &Py_NoSiteFlag);

`

``

683

`+

return read_pth_file(config, prefix, spbuffer);

`

688

684

`}

`

689

685

``

690

686

``