| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -391,9 +391,6 @@ typedef struct { | |||
| 391 | 391 | If set to -1 (default), inherit Py_FrozenFlag value. */ | |
| 392 | 392 | int _frozen; | |
| 393 | 393 | ||
| 394 | - /* If non-zero, use "main" Python initialization */ | ||
| 395 | - int _init_main; | ||
| 396 | - | ||
| 397 | 394 | } _PyCoreConfig; | |
| 398 | 395 | ||
| 399 | 396 | #ifdef MS_WINDOWS | |
@@ -428,8 +425,7 @@ typedef struct { | |||
| 428 | 425 | .buffered_stdio = -1, \ | |
| 429 | 426 | ._install_importlib = 1, \ | |
| 430 | 427 | .check_hash_pycs_mode = NULL, \ | |
| 431 | - ._frozen = -1, \ | ||
| 432 | - ._init_main = 1} | ||
| 428 | + ._frozen = -1} | ||
| 433 | 429 | /* Note: _PyCoreConfig_INIT sets other fields to 0/NULL */ | |
| 434 | 430 | ||
| 435 | 431 | #ifdef __cplusplus | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -348,7 +348,6 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): | |||
| 348 | 348 | '_install_importlib': 1, | |
| 349 | 349 | 'check_hash_pycs_mode': 'default', | |
| 350 | 350 | '_frozen': 0, | |
| 351 | - '_init_main': 1, | ||
| 352 | 351 | } | |
| 353 | 352 | if MS_WINDOWS: | |
| 354 | 353 | DEFAULT_PRE_CONFIG.update({ | |
@@ -443,7 +442,10 @@ def get_expected_config(self, expected, env): | |||
| 443 | 442 | raise Exception(f"failed to get the default config: " | |
| 444 | 443 | f"stdout={proc.stdout!r} stderr={proc.stderr!r}") | |
| 445 | 444 | stdout = proc.stdout.decode('utf-8') | |
| 446 | - config = json.loads(stdout) | ||
| 445 | + try: | ||
| 446 | + config = json.loads(stdout) | ||
| 447 | + except json.JSONDecodeError: | ||
| 448 | + self.fail(f"fail to decode stdout: {stdout!r}") | ||
| 447 | 449 | ||
| 448 | 450 | for key, value in expected.items(): | |
| 449 | 451 | if value is self.GET_DEFAULT_CONFIG: | |
@@ -496,7 +498,10 @@ def check_config(self, testname, expected_config, expected_preconfig): | |||
| 496 | 498 | ||
| 497 | 499 | out, err = self.run_embedded_interpreter(testname, env=env) | |
| 498 | 500 | # Ignore err | |
| 499 | - config = json.loads(out) | ||
| 501 | + try: | ||
| 502 | + config = json.loads(out) | ||
| 503 | + except json.JSONDecodeError: | ||
| 504 | + self.fail(f"fail to decode stdout: {out!r}") | ||
| 500 | 505 | ||
| 501 | 506 | expected_preconfig = dict(self.DEFAULT_PRE_CONFIG, **expected_preconfig) | |
| 502 | 507 | expected_config = self.get_expected_config(expected_config, env) | |
@@ -533,7 +538,6 @@ def test_init_global_config(self): | |||
| 533 | 538 | 'filesystem_encoding': 'utf-8', | |
| 534 | 539 | 'filesystem_errors': self.UTF8_MODE_ERRORS, | |
| 535 | 540 | 'user_site_directory': 0, | |
| 536 | - '_frozen': 1, | ||
| 537 | 541 | } | |
| 538 | 542 | self.check_config("init_global_config", config, preconfig) | |
| 539 | 543 | ||
@@ -578,7 +582,6 @@ def test_init_from_config(self): | |||
| 578 | 582 | 'faulthandler': 1, | |
| 579 | 583 | ||
| 580 | 584 | 'check_hash_pycs_mode': 'always', | |
| 581 | - '_frozen': 1, | ||
| 582 | 585 | } | |
| 583 | 586 | self.check_config("init_from_config", config, preconfig) | |
| 584 | 587 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,7 +84,6 @@ main(int argc, char *argv[]) | |||
| 84 | 84 | /* Don't install importlib, since it could execute outdated bytecode. */ | |
| 85 | 85 | config._install_importlib = 0; | |
| 86 | 86 | config._frozen = 1; | |
| 87 | - config._init_main = 0; | ||
| 88 | 87 | ||
| 89 | 88 | _PyInitError err = _Py_InitializeFromConfig(&config); | |
| 90 | 89 | /* No need to call _PyCoreConfig_Clear() since we didn't allocate any | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -354,8 +354,6 @@ static int test_init_global_config(void) | |||
| 354 | 354 | putenv("PYTHONUNBUFFERED="); | |
| 355 | 355 | Py_UnbufferedStdioFlag = 1; | |
| 356 | 356 | ||
| 357 | - Py_FrozenFlag = 1; | ||
| 358 | - | ||
| 359 | 357 | /* FIXME: test Py_LegacyWindowsFSEncodingFlag */ | |
| 360 | 358 | /* FIXME: test Py_LegacyWindowsStdioFlag */ | |
| 361 | 359 | ||
@@ -497,9 +495,6 @@ static int test_init_from_config(void) | |||
| 497 | 495 | ||
| 498 | 496 | config.check_hash_pycs_mode = L"always"; | |
| 499 | 497 | ||
| 500 | - Py_FrozenFlag = 0; | ||
| 501 | - config._frozen = 1; | ||
| 502 | - | ||
| 503 | 498 | err = _Py_InitializeFromConfig(&config); | |
| 504 | 499 | if (_Py_INIT_FAILED(err)) { | |
| 505 | 500 | _Py_ExitInitError(err); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -667,7 +667,6 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2) | |||
| 667 | 667 | COPY_WSTR_ATTR(run_filename); | |
| 668 | 668 | COPY_WSTR_ATTR(check_hash_pycs_mode); | |
| 669 | 669 | COPY_ATTR(_frozen); | |
| 670 | - COPY_ATTR(_init_main); | ||
| 671 | 670 | ||
| 672 | 671 | #undef COPY_ATTR | |
| 673 | 672 | #undef COPY_WSTR_ATTR | |
@@ -766,7 +765,6 @@ _PyCoreConfig_AsDict(const _PyCoreConfig *config) | |||
| 766 | 765 | SET_ITEM_INT(_install_importlib); | |
| 767 | 766 | SET_ITEM_WSTR(check_hash_pycs_mode); | |
| 768 | 767 | SET_ITEM_INT(_frozen); | |
| 769 | - SET_ITEM_INT(_init_main); | ||
| 770 | 768 | ||
| 771 | 769 | return dict; | |
| 772 | 770 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -988,7 +988,7 @@ init_python(const _PyCoreConfig *config, const _PyArgv *args) | |||
| 988 | 988 | } | |
| 989 | 989 | config = &interp->core_config; | |
| 990 | 990 | ||
| 991 | - if (config->_init_main) { | ||
| 991 | + if (!config->_frozen) { | ||
| 992 | 992 | err = _Py_InitializeMainInterpreter(runtime, interp); | |
| 993 | 993 | if (_Py_INIT_FAILED(err)) { | |
| 994 | 994 | return err; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments