diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-08-01 00:13:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-01 00:13:04 (GMT) |
commit | b75d7e243512afcfb2285e6471262478383e09db (patch) | |
tree | a669ce23fbfe84ddbbb5b84ec0112df60ccf5f73 /Python/frozenmain.c | |
parent | 8ed317f1ca42a43df14282bbc3ccc0b5610432f4 (diff) | |
download | cpython-b75d7e243512afcfb2285e6471262478383e09db.zip cpython-b75d7e243512afcfb2285e6471262478383e09db.tar.gz cpython-b75d7e243512afcfb2285e6471262478383e09db.tar.bz2 |
bpo-34170: Add _PyCoreConfig._frozen parameter (GH-8591)
Modify frozenmain.c to use _Py_InitializeFromConfig().
Diffstat (limited to 'Python/frozenmain.c')
-rw-r--r-- | Python/frozenmain.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Python/frozenmain.c b/Python/frozenmain.c index a3b6196..86af2b6 100644 --- a/Python/frozenmain.c +++ b/Python/frozenmain.c @@ -41,7 +41,8 @@ Py_FrozenMain(int argc, char **argv) } } - Py_FrozenFlag = 1; /* Suppress errors from getpath.c */ + _PyCoreConfig config = _PyCoreConfig_INIT; + config._frozen = 1; /* Suppress errors from getpath.c */ if ((p = Py_GETENV("PYTHONINSPECT")) && *p != '\0') inspect = 1; @@ -80,7 +81,14 @@ Py_FrozenMain(int argc, char **argv) #endif /* MS_WINDOWS */ if (argc >= 1) Py_SetProgramName(argv_copy[0]); - Py_Initialize(); + + err = _Py_InitializeFromConfig(&config); + /* No need to call _PyCoreConfig_Clear() since we didn't allocate any + memory: program_name is a constant string. */ + if (_Py_INIT_FAILED(err)) { + _Py_FatalInitError(err); + } + #ifdef MS_WINDOWS PyWinFreeze_ExeInit(); #endif |