summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-10-19 22:41:28 (GMT)
committerPablo Galindo <pablogsal@gmail.com>2022-10-22 19:15:49 (GMT)
commitfc127628d581d8b64c602cd16573a84ff06f035d (patch)
tree66e32e58ba2f8a59c4ef9c5923e078a025bf2785
parent585c95df95780c3a66db8b458713b172d7874b64 (diff)
downloadcpython-fc127628d581d8b64c602cd16573a84ff06f035d.zip
cpython-fc127628d581d8b64c602cd16573a84ff06f035d.tar.gz
cpython-fc127628d581d8b64c602cd16573a84ff06f035d.tar.bz2
gh-98414: py.exe launcher does not use defaults for -V:company/ option (GH-98460)
(cherry picked from commit 4bd63f66cd4f6e8d549f88ae0f4b0106d522b6bb) Co-authored-by: Steve Dower <steve.dower@python.org>
-rw-r--r--Lib/test/test_launcher.py7
-rw-r--r--Misc/NEWS.d/next/Windows/2022-10-19-19-35-37.gh-issue-98414.FbHZuS.rst3
-rw-r--r--PC/launcher2.c1
3 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_launcher.py b/Lib/test/test_launcher.py
index 97686e6..ba6856b 100644
--- a/Lib/test/test_launcher.py
+++ b/Lib/test/test_launcher.py
@@ -370,6 +370,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
index 0000000..df07b7f
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2022-10-19-19-35-37.gh-issue-98414.FbHZuS.rst
@@ -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.
diff --git a/PC/launcher2.c b/PC/launcher2.c
index 23eaa19..1f6f97b 100644
--- a/PC/launcher2.c
+++ b/PC/launcher2.c
@@ -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;