8000 bpo-8901: Windows registry path not ignored with the -E option by ZackerySpytz · Pull Request #18169 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-8901: Windows registry path not ignored with the -E option #18169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,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
==========

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ignore the Windows registry when the ``-E`` option is used.
7 changes: 5 additions & 2 deletions PC/getpathp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
41CD anything better to use! */
Expand Down
0