[issue38234] The value of Py_SetPath is not used to populate the configuration

STINNER Victor report at bugs.python.org
Mon Sep 23 11:16:44 EDT 2019


STINNER Victor <vstinner at python.org> added the comment:

Steve:
> Why are we keeping the DLL path around at all? It should only be being used in 1-2 places during path calculation.

_PyPathConfig_Init() initializes _Py_dll_path global variable which is only used by _Py_CheckPython3(). _Py_CheckPython3() is called at each _PyImport_FindSharedFuncptrWindows() call which is used by _PyImport_LoadDynamicModuleWithSpec() (to import a .pyd extension). I tried to minimize my changes to fix the issue, I tried to leave _Py_CheckPython3() unchanged. But I made one change in _Py_CheckPython3(): it handles the case _Py_dll_path=NULL... which should never occur, but I wasn't 100% sure that it really can never occur.

Python 3.6 (before my init work), _Py_CheckPython3() used "static wchar_t dllpath[MAXPATHLEN+1];": it was less important when dllpath is initialized.

--

_PyPathConfig_Calculate() of PC/getpathp.c now uses a temporary variable which stores the result of _Py_GetDLLPath().

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38234>
_______________________________________


More information about the Python-bugs-list mailing list