summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_site.py16
-rw-r--r--PCbuild/python.props15
-rw-r--r--Python/pylifecycle.c7
3 files changed, 31 insertions, 7 deletions
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 0924f01..1501622 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -547,12 +547,16 @@ class _pthFileTests(unittest.TestCase):
env = os.environ.copy()
env['PYTHONPATH'] = 'from-env'
env['PATH'] = '{};{}'.format(exe_prefix, os.getenv('PATH'))
- rc = subprocess.call([exe_file, '-c',
- 'import sys; sys.exit(sys.flags.no_site and '
- 'len(sys.path) > 200 and '
- 'sys.path == %r)' % sys_path,
- ], env=env)
- self.assertTrue(rc, "sys.path is incorrect")
+ output = subprocess.check_output([exe_file, '-c',
+ 'import sys; print("\\n".join(sys.path) if sys.flags.no_site else "")'
+ ], env=env, encoding='ansi')
+ actual_sys_path = output.rstrip().split('\n')
+ self.assert_(actual_sys_path, "sys.flags.no_site was False")
+ self.assertEqual(
+ actual_sys_path,
+ sys_path,
+ "sys.path is incorrect"
+ )
def test_underpth_file(self):
libpath = os.path.dirname(os.path.dirname(encodings.__file__))
diff --git a/PCbuild/python.props b/PCbuild/python.props
index d6bfd08..563487e 100644
--- a/PCbuild/python.props
+++ b/PCbuild/python.props
@@ -63,6 +63,21 @@
<PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
</PropertyGroup>
+ <PropertyGroup Condition="$(DefaultWindowsSDKVersion) == ''">
+ <!--
+ Attempt to select the latest installed WinSDK. If we don't find any, then we will
+ let the MSBuild targets determine which one it wants to use (typically the earliest
+ possible version). Since we limit WINVER to Windows 7 anyway, it doesn't really
+ matter which WinSDK version we use.
+ -->
+ <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.15063'">10.0.15063.0</DefaultWindowsSDKVersion>
+ <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.15063'">10.0.15063.0</DefaultWindowsSDKVersion>
+ <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10586'">10.0.10586.0</DefaultWindowsSDKVersion>
+ <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10586'">10.0.10586.0</DefaultWindowsSDKVersion>
+ <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10240'">10.0.10240.0</DefaultWindowsSDKVersion>
+ <DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10240'">10.0.10240.0</DefaultWindowsSDKVersion>
+ </PropertyGroup>
+
<PropertyGroup Condition="'$(OverrideVersion)' == ''">
<!--
Read version information from Include\patchlevel.h. The following properties are set:
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 03601ea..d2b2777 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -412,10 +412,15 @@ _Py_InitializeEx_Private(int install_sigs, int install_importlib)
if (interp->sysdict == NULL)
Py_FatalError("Py_Initialize: can't initialize sys dict");
Py_INCREF(interp->sysdict);
+
+ /* GetPath may initialize state that _PySys_EndInit locks
+ in, and so has to be called first.
+
+ Hopefully one day Eric Snow will fix this. */
+ PySys_SetPath(Py_GetPath());
if (_PySys_EndInit(interp->sysdict) < 0)
Py_FatalError("Py_Initialize: can't initialize sys");
_PyImport_FixupBuiltin(sysmod, "sys");
- PySys_SetPath(Py_GetPath());
PyDict_SetItemString(interp->sysdict, "modules",
interp->modules);