]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-98414: py.exe launcher does not use defaults for -V:company/ option (GH-98460)
authorSteve Dower <steve.dower@python.org>
Wed, 19 Oct 2022 22:00:09 +0000 (23:00 +0100)
committerGitHub <noreply@github.com>
Wed, 19 Oct 2022 22:00:09 +0000 (23:00 +0100)
Lib/test/test_launcher.py
Misc/NEWS.d/next/Windows/2022-10-19-19-35-37.gh-issue-98414.FbHZuS.rst [new file with mode: 0644]
PC/launcher2.c

index be0cd90c7906f5cbb58eea0552342f68545fb9ad..432a44622b5f00646b33c0f2bc028c03a8d0e5a7 100644 (file)
@@ -369,6 +369,13 @@ class TestLauncher(unittest.TestCase, RunPyMixin):
         self.assertEqual(company, data["env.company"])
         self.assertEqual("3.100", data["env.tag"])
 
+    def test_filter_to_company_with_default(self):
+        company = "PythonTestSuite"
+        data = self.run_py([f"-V:{company}/"], env=dict(PY_PYTHON="3.0"))
+        self.assertEqual("X.Y.exe", data["LaunchCommand"])
+        self.assertEqual(company, data["env.company"])
+        self.assertEqual("3.100", data["env.tag"])
+
     def test_filter_to_tag(self):
         company = "PythonTestSuite"
         data = self.run_py([f"-V:3.100"])
diff --git a/Misc/NEWS.d/next/Windows/2022-10-19-19-35-37.gh-issue-98414.FbHZuS.rst b/Misc/NEWS.d/next/Windows/2022-10-19-19-35-37.gh-issue-98414.FbHZuS.rst
new file mode 100644 (file)
index 0000000..df07b7f
--- /dev/null
@@ -0,0 +1,3 @@
+Fix :file:`py.exe` launcher handling of ``-V:<company>/`` option when
+default preferences have been set in environment variables or configuration
+files.
index 23eaa19dde38e868ab6470857ff33880b40f8650..1f6f97b82092b9888a50df5953e76c6e3cc4bfc1 100644 (file)
@@ -653,6 +653,7 @@ parseCommandLine(SearchInfo *search)
                     search->tag = argStart;
                 }
                 search->tagLength = (int)(tail - search->tag);
+                search->allowDefaults = false;
                 search->restOfCmdLine = tail;
             } else if (MATCHES(L"0") || MATCHES(L"-list")) {
                 search->list = true;