[Python-Dev] New Python Initialization API

Victor Stinner vstinner at redhat.com
Fri Apr 5 12:36:37 EDT 2019


For the PyMainConfig structure idea, I cannot comment at this point. I
need more time to think about it.


About the "path configuration" fields, maybe a first step to enhance
the API would be to add the the following function:

PyInitError PyConfig_ComputePath(PyConfig *config, const wchar *home);

where home can be NULL (and PyConfig.module_search_paths_env field
goes away: the function reads PYTHONPATH env var internally).

This function would "compute the path configuration", what's currently
listed in _PyCoreConfig under:

    /* Path configuration outputs */
    int use_module_search_paths;  /* If non-zero, use module_search_paths */
    _PyWstrList module_search_paths;  /* sys.path paths. Computed if
                                       use_module_search_paths is equal
                                       to zero. */

    wchar_t *executable;    /* sys.executable */
    wchar_t *prefix;        /* sys.prefix */
    wchar_t *base_prefix;   /* sys.base_prefix */
    wchar_t *exec_prefix;   /* sys.exec_prefix */
    wchar_t *base_exec_prefix;  /* sys.base_exec_prefix */
#ifdef MS_WINDOWS
    wchar_t *dll_path;      /* Windows DLL path */
#endif

Victor


More information about the Python-Dev mailing list