STINNER Victor <vstin...@redhat.com> added the comment:

In term of API, we get something like:

    _PyInitError err;

    _PyPreConfig preconfig = _PyPreConfig_INIT;
    preconfig.utf8_mode = 1;
    preconfig.allocator = "malloc";

    _PyInitError err = _Py_PreInitializeFromPreConfig(&preconfig);
    if (_Py_INIT_FAILED(err)) {
        _Py_ExitInitError(err);
    }

    /* PyMem_RawMalloc and Py_DecodeLocale can now be used */

    _PyCoreConfig config = _PyCoreConfig_INIT;
    config.user_site_directory = 0;

    err = _Py_InitializeFromConfig(&config);
    if (_Py_INIT_FAILED(err)) {
        _Py_ExitInitError(err);
    }

    /* ... use Python ... */

    Py_Finalize();

    /* Note: no need to "free" preconfig nor config memory, they use constants 
*/

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36301>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to