diff options
author | Zackery Spytz <zspytz@gmail.com> | 2020-03-30 16:04:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-30 16:04:45 (GMT) |
commit | 676b105111e2399ed400cd13ab113f9aa891760d (patch) | |
tree | 1a89af60a005e6829ec3d99535f2a03cf6162563 | |
parent | 53e4c91725083975598350877e2ed8e2d0194114 (diff) | |
download | cpython-676b105111e2399ed400cd13ab113f9aa891760d.zip cpython-676b105111e2399ed400cd13ab113f9aa891760d.tar.gz cpython-676b105111e2399ed400cd13ab113f9aa891760d.tar.bz2 |
bpo-8901: Windows registry path is now ignored with the -E option (GH-18169)
-rw-r--r-- | Doc/whatsnew/3.9.rst | 5 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Windows/2020-01-24-09-15-41.bpo-8901.hVnhGO.rst | 1 | ||||
-rw-r--r-- | PC/getpathp.c | 7 |
3 files changed, 11 insertions, 2 deletions
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index f58bcbc..59083da 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -548,6 +548,11 @@ Build and C API Changes * The :c:func:`PyModule_AddType` function is added to help adding a type to a module. (Contributed by Dong-hee Na in :issue:`40024`.) +* The Windows registry is no longer used to initialize :data:`sys.path` when + the ``-E`` option is used. This is significant when embedding Python on + Windows. + (Contributed by Zackery Spytz in :issue:`8901`.) + Deprecated ========== diff --git a/Misc/NEWS.d/next/Windows/2020-01-24-09-15-41.bpo-8901.hVnhGO.rst b/Misc/NEWS.d/next/Windows/2020-01-24-09-15-41.bpo-8901.hVnhGO.rst new file mode 100644 index 0000000..1d452cf --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2020-01-24-09-15-41.bpo-8901.hVnhGO.rst @@ -0,0 +1 @@ +Ignore the Windows registry when the ``-E`` option is used. diff --git a/PC/getpathp.c b/PC/getpathp.c index 7a2c1fd..aa820e5 100644 --- a/PC/getpathp.c +++ b/PC/getpathp.c @@ -783,8 +783,11 @@ calculate_module_search_path(PyCalculatePath *calculate, { int skiphome = calculate->home==NULL ? 0 : 1; #ifdef Py_ENABLE_SHARED - calculate->machine_path = getpythonregpath(HKEY_LOCAL_MACHINE, skiphome); - calculate->user_path = getpythonregpath(HKEY_CURRENT_USER, skiphome); + if (!Py_IgnoreEnvironmentFlag) { + calculate->machine_path = getpythonregpath(HKEY_LOCAL_MACHINE, + skiphome); + calculate->user_path = getpythonregpath(HKEY_CURRENT_USER, skiphome); + } #endif /* We only use the default relative PYTHONPATH if we haven't anything better to use! */ |