From bd93c62a12b74eccabff866eba265828d04db569 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sat, 27 Oct 2018 18:48:30 +0100
Subject: [PATCH 08/26] Disable registry lookup unless CONDA_PY_ALLOW_REG_PATHS
 is not 0

Co-authored-by: Isuru Fernando<isuruf@gmail.com>
---
 Modules/getpath.c  | 1 +
 Modules/getpath.py | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Modules/getpath.c b/Modules/getpath.c
index 61d654065fd..b80297c580c 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -907,6 +907,7 @@ _PyConfig_InitPathConfig(PyConfig *config, int compute_path_config)
         !env_to_dict(dict, "ENV_PATH", 0) ||
         !env_to_dict(dict, "ENV_PYTHONHOME", 0) ||
         !env_to_dict(dict, "ENV_PYTHONEXECUTABLE", 0) ||
+        !env_to_dict(dict, "ENV_CONDA_PY_ALLOW_REG_PATHS", 0) ||
         !env_to_dict(dict, "ENV___PYVENV_LAUNCHER__", 1) ||
         !progname_to_dict(dict, "real_executable") ||
         !library_to_dict(dict, "library") ||
diff --git a/Modules/getpath.py b/Modules/getpath.py
index 74f918cf28e..0726b9932c6 100644
--- a/Modules/getpath.py
+++ b/Modules/getpath.py
@@ -51,6 +51,7 @@
 # ENV_PYTHONHOME          -- [in] getenv(...)
 # ENV_PYTHONEXECUTABLE    -- [in] getenv(...)
 # ENV___PYVENV_LAUNCHER__ -- [in] getenv(...)
+# ENV_CONDA_PY_ALLOW_REG_PATHS -- [in] getenv(...)
 
 # ** Values calculated at runtime **
 # config            -- [in/out] dict of the PyConfig structure
@@ -673,7 +674,7 @@ def search_up(prefix, *landmarks, test=isfile):
     else:
         pythonpath.append(joinpath(prefix, ZIP_LANDMARK))
 
-    if os_name == 'nt' and use_environment and winreg:
+    if os_name == 'nt' and use_environment and winreg and ENV_CONDA_PY_ALLOW_REG_PATHS and ENV_CONDA_PY_ALLOW_REG_PATHS != '0':
         # QUIRK: Windows also lists paths in the registry. Paths are stored
         # as the default value of each subkey of
         # {HKCU,HKLM}\Software\Python\PythonCore\{winver}\PythonPath
