8000 bpo-8901: Windows registry path is now ignored with the -E option (GH… · python/cpython@676b105 · GitHub
[go: up one dir, main page]

Skip to content

Commit 676b105

Browse files
authored
bpo-8901: Windows registry path is now ignored with the -E option (GH-18169)
1 parent 53e4c91 commit 676b105

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Doc/whatsnew/3.9.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,11 @@ Build and C API Changes
548548
* The :c:func:`PyModule_AddType` function is added to help adding a type to a module.
549549
(Contributed by Dong-hee Na in :issue:`40024`.)
550550

551+
* The Windows registry is no longer used to initialize :data:`sys.path` when
552+
the ``-E`` option is used. This is significant when embedding Python on
553+
Windows.
554+
(Contributed by Zackery Spytz in :issue:`8901`.)
555+
551556
Deprecated
552557
==========
553558

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ignore the Windows registry when the ``-E`` option is used.

PC/getpathp.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,11 @@ calculate_module_search_path(PyCalculatePath *calculate,
783783
{
784784
int skiphome = calculate->home==NULL ? 0 : 1;
785785
#ifdef Py_ENABLE_SHARED
786-
calculate->machine_path = getpythonregpath(HKEY_LOCAL_MACHINE, skiphome);
787-
calculate->user_path = getpythonregpath(HKEY_CURRENT_USER, skiphome);
786+
if (!Py_IgnoreEnvironmentFlag) {
787+
calculate->machine_path = getpythonregpath(HKEY_LOCAL_MACHINE,
788+
skiphome);
789+
calculate->user_path = getpythonregpath(HKEY_CURRENT_USER, skiphome);
790+
}
788791
#endif
789792
/* We only use the default relative PYTHONPATH if we haven't
790793
anything better to use! */

0 commit comments

Comments
 (0)
0