bpo-8901: Windows registry path is now ignored with the -E option (GH-18169)

This commit is contained in:
Zackery Spytz 2020-03-30 10:04:45 -06:00 committed by GitHub
parent 53e4c91725
commit 676b105111
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View File

@ -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. * The :c:func:`PyModule_AddType` function is added to help adding a type to a module.
(Contributed by Dong-hee Na in :issue:`40024`.) (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 Deprecated
========== ==========

View File

@ -0,0 +1 @@
Ignore the Windows registry when the ``-E`` option is used.

View File

@ -783,8 +783,11 @@ calculate_module_search_path(PyCalculatePath *calculate,
{ {
int skiphome = calculate->home==NULL ? 0 : 1; int skiphome = calculate->home==NULL ? 0 : 1;
#ifdef Py_ENABLE_SHARED #ifdef Py_ENABLE_SHARED
calculate->machine_path = getpythonregpath(HKEY_LOCAL_MACHINE, skiphome); if (!Py_IgnoreEnvironmentFlag) {
calculate->user_path = getpythonregpath(HKEY_CURRENT_USER, skiphome); calculate->machine_path = getpythonregpath(HKEY_LOCAL_MACHINE,
skiphome);
calculate->user_path = getpythonregpath(HKEY_CURRENT_USER, skiphome);
}
#endif #endif
/* We only use the default relative PYTHONPATH if we haven't /* We only use the default relative PYTHONPATH if we haven't
anything better to use! */ anything better to use! */