This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Update Py_FrozenMain() for _PyCoreConfig (PEP 587)
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.8
process
Status: closed Resolution: duplicate
Dependencies: Superseder: [C API] Add tests on Py_FrozenMain()
View: 44131
Assigned To: Nosy List: ncoghlan, steve.dower, twouters, vstinner
Priority: normal Keywords:

Created on 2019-05-16 15:26 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg342653 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-16 15:26
Python/frozenmain.c should use pre-initialization and be adapted for _PyCoreConfig. Py_FrozenMain() reimplements some features which are now implemented by _Py_InitializeFromConfig():

* disable C streams (stdin, stdout, stderr) buffering
* decode argv using Py_DecodeLocale()
* set the program name (call Py_SetProgramName())
* set sys.argv
* reimplement the REPL

It seems like it could use _Py_RunMain(), but I'm not sure.
msg343446 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-25 00:41
Another file which should maybe also be updated to PEP 587, PC/bdist_wininst/install.c:

static int compile_filelist(HINSTANCE hPython, BOOL optimize_flag)
{
    DECLPROC(hPython, void, Py_Initialize, (void));
    DECLPROC(hPython, void, Py_SetProgramName, (wchar_t *));
    DECLPROC(hPython, void, Py_Finalize, (void));
    DECLPROC(hPython, int, PyRun_SimpleString, (char *));
    DECLPROC(hPython, PyObject *, PySys_GetObject, (char *));
    DECLVAR(hPython, int, Py_OptimizeFlag);

    int errors = 0;
    struct tagFile *p = file_list;

    if (!p)
        return 0;

    if (!Py_Initialize || !Py_SetProgramName || !Py_Finalize)
        return -1;

    if (!PyRun_SimpleString || !PySys_GetObject || !Py_OptimizeFlag)
        return -1;

    *Py_OptimizeFlag = optimize_flag ? 1 : 0;
    Py_SetProgramName(wmodulename);
    Py_Initialize();

    errors += do_compile_files(PyRun_SimpleString, optimize_flag);
    Py_Finalize();

    return errors;
}
msg394482 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-05-26 22:38
Fixed by bpo-44131.
msg394484 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-05-26 22:39
> Another file which should maybe also be updated to PEP 587, PC/bdist_wininst/install.c

PC/bdist_wininst/ has been removed in the meanwhile.
History
Date User Action Args
2022-04-11 14:59:15adminsetgithub: 81121
2021-05-26 22:39:29vstinnersetmessages: + msg394484
2021-05-26 22:38:11vstinnersetstatus: open -> closed
superseder: [C API] Add tests on Py_FrozenMain()
messages: + msg394482

resolution: duplicate
stage: resolved
2019-05-25 00:41:10vstinnersetmessages: + msg343446
2019-05-16 15:26:17vstinnercreate