[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: Hum. The code in Python 3.8 is complicated. When Py_SetPath() is called, Python starts by computing the Python Path Configuration because of: /* Getting the program full path calls pathconfig_global_init() */ wchar_t *program_full_path = _PyMem_RawWcs

[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-12 Thread Eryk Sun
Eryk Sun added the comment: > I still don't understand if the issue involves Py_SetPath() or not. It seems to me that this issue is concerned with the default behavior that looks for the "lib/os.py" landmark via search_for_prefix() in PC/getpathp.c. Starting at the image path, it searches fo

[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: > I thought that *all* versions of Python located the standard library by > searching for os.py... The current implementation of the Python Path Configuration can be found in: * Windows: PC/getpathp.c * Unix: Modules/getpath.c It should be skipped if Py_Set

[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-12 Thread Paul Moore
Paul Moore added the comment: I thought that *all* versions of Python located the standard library by searching for os.py... -- ___ Python tracker ___ ___

[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: Python has an unit test on Py_SetPath(): test_embed.test_init_setpath. > Write following code that only call Py_Initialize(): (...) Do you mean that on Windows Python looks for modules in C:\Lib\ just by calling Py_Initialize()? > According to https://doc

[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: The reference documentation for the Python Path Configuration can be found at: https://docs.python.org/dev/c-api/init_config.html#python-path-configuration Currently, Py_SetPath(path) indirectly sets the following PyConfig members: * prefix = "" * exec_prefix

[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-11 Thread Christian Heimes
Change by Christian Heimes : -- nosy: +christian.heimes ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https

[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-11 Thread Christian Heimes
Change by Christian Heimes : -- components: +Interpreter Core, Windows -C API nosy: +paul.moore, steve.dower, tim.golden, vstinner, zach.ware type: behavior -> security ___ Python tracker

[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-11 Thread houjingyi
New submission from houjingyi : environment: windows 10, python3.8.7 installed to "C:\Program Files\Python38". datail info: According to https://docs.python.org/3/c-api/init.html: "Py_SetPath() set the default module search path. If this function is called before Py_Initialize(), then Py_GetPa